xiaohh
Hi Thiagoralves
 
From this page, discreate input contacts can be written,  2.5 Modbus Addressing – Autonomy (autonomylogic.com).
But from ModbusSlave.cpp, function code 5 and 15 do not support discreate input contacts write. Is that missing?

ModbusSlave.cpp can be modified to support discreate input contacts write, but I'd like to get your comments before doing that, since discreate input contacts and discreate output coils share the same address, one possible way is to set different offset, how do you think of that?
 
In Mitsubishi FX series PLC, there are many M contacts which can be read/written, they are very useful in PLC programmng, I guess the discreate input contacts (address range from 800 to 1599) are similar with Mitsubishi M contacts, right?
 
 
[203128%2F8976558%2Fmceclip0]
Reply 0 0
thiagoralves
By definition the Modbus protocol does not allow writing to inputs. There is no function code to perform that action. The table you listed is wrong, and I've just fixed it. Function code 5 and 15 are used to write to coils, as their own name implies: Write Single Coil and Write Multiple Coils.
 
With that being said, nothing prevents you from using the entire Discrete Output Coils range (0 - 1599) as M contacts. Just assign your variable to one of those locations and it will be available on Modbus as a read/write coil.
Reply 0 0
Reply