brsunley
I am new to alot of this stuff and i am wondering has anyone got a relay board using N4D8B08 chip working? i have figured out holding registers control both inputs and outputs. it supports functions 03 and 06 but when i add it as a slave device only the read holding registers works. write holding registers says write failure on mb device.  The board responds to hex commands using modbus but can't seem to get it to work with openplc runtime.
 
What am i missing?
Reply 0 0
richw
I think OpenPLC runtime on supports writing multiple registers (function code 16) not writing single Registers
Reply 0 0
apbirt
Hi brsunley, i would like to know how you wrote to the output relays using the modbus in slave devices and code you needed to turn them on and off? I know how to use the Modbus slave devices as I'm reading a number of Modbus sensors OK
Reply 0 0
thiagoralves
Modbus slave devices are configured from the OpenPLC runtime webserver. On the left panel select slave devices and add a new slave configuring it according to your slave device settings. Once you have it configured, the inputs and outputs of the slave devices will be mapped to located variables (i.e. %QX100.0) which will be shown in the slave devices table right after adding the slave device. On your PLC program, all you have to do is create a variable with the location of the  inputs/outputs you want to use
Reply 0 0
apbirt
Hi Thiago,
Thanks for your reply! I can get either read the inputs at holding register (%IW100) starting address 129 x 8 or write the outputs by sending 768 to %QW100 x 8 and then reading their status on Holding register (%IW100) start address 1 x 8. The problem i have that whichever is first in the slave devices que will work but the following one doesn't, so i can either read the inputs or write to the outputs but not both.
Reply 0 0
apbirt
Sorry the picture i uploaded showed my original configuration for the write I amended it %QW100 registers
Reply 0 0
thiagoralves
When you add a Modbus slave device you can either write to a register or read from a register, but never read and write to the same register.
Reply 0 0
apbirt
Hi Thiago,
I managed to get it working, I had to change the delay time on the input modbus to 10 seconds and 8 seconds on the read output coil status. I played around with the delay times and found those times to work. I also created some logic to write to the output coils which i have attached for anyone else that may be having issues with this IO Module.
So to start with i used 3 modbus slave devices one to write to the coils of which i set a 0 second delay. A second one to read the input registers, which i set with a 10 second delay time and a third to read the output coil status registers which i set with an 8 second delay time.
On the logic i uploaded this is the first of eight sets one for each coil.
For testing purposes i used NodeRed to generate a write to each coil e.g. Output1_Write. There is an output coil status Output_1_Status which i read back from the output coil statuses and convert to a Boolean.
When a new write occurs or there is a mismatch between the required output and the feedback status a write latch is activated Output1WriteLatch, this will send the value 768 to the output coils. this toggles the output on and off hence the need for the feedback to check if it is the correct state. I also used a retransmit logic as i found if i just left the input on continuously until the Output1WriteLatch unlatch the output would start toggling.
If anyone has a better way of doing this i would be very interested. But for now, it appears to be repeatable and reliable so I'm confident it will work OK.
Reply 1 0
Reply