Hello Guest it is April 20, 2024, 05:18:38 AM

Author Topic: Modbus IO buttons  (Read 3123 times)

0 Members and 1 Guest are viewing this topic.

Modbus IO buttons
« on: February 07, 2008, 06:59:48 PM »
I am trying to setup control buttons for outputs in my DL06 PLC.  I have communication, but I can't figure out how to make a button force a specific output.  My output range starts at 2055, so I put that in the OEM code, and nothing.  Do I have to build a brain for each button?

Thanks

Offline poppabear

*
  • *
  •  2,235 2,235
  • Briceville, TN, USA
    • View Profile
Re: Modbus IO buttons
« Reply #1 on: February 07, 2008, 10:01:02 PM »
no put something like this in your button and have an LED next to it, I.e. pick LED ranges 1500 or higher.
in the button put

If GetUserLED(1500) Then   'User Led 1500 that is right next to the button
SetUserLED(1500,0)
Else
SetUserLED(1500,1)
End If

do this for each button output you want, and increment up the user leds by 1 per button.

Then goto edit brain, start a brain, pick as your input your start range of your User leds, i.e. 1500 do a NOP lobe, that terminates to the Modbus address, and config # that corresponds to you output side goint to the PLC. NOTE: IF you using Bit of word, you will need to remember to track  which bit per LED output rung you use, unless you send an entire word per output.  In the ADC PLC, if your Brining in Bit or Word, you will need to remember what bit effected what bit of word for your inputs on the PLC rungs. If your Bringing in Entire words, then you will need complete Bregister with a .0 on the end if you want to use the discreates in user variable memory. Other wise you will have to look up the control bits register, just remember if your using bit of word out from mach, you can control the Control bits in sequence. If your using entire words then you will skip Control bits in blocks of 20 in octal.

Scott
fun times
Re: Modbus IO buttons
« Reply #2 on: February 08, 2008, 10:43:16 AM »
Thanks Scott,

I got the button to work, and can watch it pushing the output through the "view brain" function.  Very cool by the way.  I still am having trouble actually hitting the output.  My outputs start on slave 1, address 2048, and there are 16 on the base DL06.  In the "test modbus", I can force the bits using 2048 and up, and it works.  In the configuration, the top in the chart is listed as the inputs, discrete, 20 of them starting at 2048.  The second row is the 16 outputs, starting at 2048, and the third row is the first add-on card. 

I am not very strong on the word vs. bit, so maybe that is my first issue.  As for the PLC, there is no code at all.  I had it in there, but I couldn't hit the outputs through modbus if they were terminated on a rung, so I cleared it all out, and i could force the bits through the "test modbus".

Roger
Re: Modbus IO buttons
« Reply #3 on: February 08, 2008, 03:31:04 PM »
I got it working.  It was a matter of clicking the right boxes.

Thanks for reading.