
Ryan Poethke (Customer) asked a question.
I recently had an application where I had to communicate with an external device over MODBUS TCP.
We started with the setup below:
(10) status bits (MC)
(1) status register (MRH)
(4) bits written by the external device that controlled portions of the PLC program (MI)
After solving the inevitable off-by-one issue, we found that the external device could read the MC and MRH info just fine, but absolutely nothing would get the MI bits to change state. The external device was writing, and the PLC was responding as though it had correctly received the command, but the bits never changed state.
While waiting on hold with Tech Support, we tried to have the external device write to unused MC bits, and it worked - I hung up with tech support. I altered the PLC program to use MC bits for everything, but I'm unsure why we couldn't write to the MI bits successfully. Why didn't using the MI bits work?
Thanks,
Ryan Poethke
Who is the Master/Client, who is the Slave/Server? If the BRX is the Slave and your remote device is the Master, there is no Modbus FC to Write to MI (discrete Inputs). Modbus does not support the Master writing to Slave Inputs. A Modbus Master can write to BRX MC and MHR (and read them), but the Modbus Master can only read from MI and MIR where BRX is the slave.
Normally, the PLC is the Master. Unless you are implementing a kind of gateway function, you don't need to use MI/MC/MHR or MIR memory. Let us know if this is the case.
FYI, if the PLC does need to be the Modbus Master/Client, you might want to look at Do-more's 2.9 implementation of a Modbus I/O Scanner feature.
The external device is initiating both reads and writes, so it's the Master (?). Read only for MI and MIR isn't clear in the documentation. Good to know a Master (remote device performing reads and writes) can both read and write MC and MHR registers - I have another application coming up soon that will need this MODBUS functionality. Master/Client/Slave/Server has always been confusing in MODBUS.
The I/O Scanner looks interesting, but I have absolutely no idea how to implement it or why I would want to use it in a given situation.
SceneryDriver
The Modbus I/O Scanner would be useful where the BRX PLC is the Master and have a set of Modbus Slave devices like a smart valve or a drive being controlled by the BRX. In your situation, BRX PLC is the Slave and the Master is something like a SCADA package or a peer controller.
Read-only isn't really a function of the PLC, it's a function of the protocol. There is no write function for inputs and input registers, only for coils and holding registers. Not sure what you would be doing from the master to attempt to write them.