Search code examples
modbusmodbus-tcppymodbus

Can I write in an Input Register? Modbus


I've been working for 2 months in a MODBUS project and now I found a problem.

My client is asking me to write in an input register (Address 30001 to 40000).

I thought that was not a thing for me because every modbus documentation says that 30001 to 40000 registers are read-only.

enter image description here

Is it even possible to write in those registers? Thanks in advance


Solution

  • Both holding and input register related functions contain a 2-byte address value. This means that you can have 65536 input registers and 65536 holding registers in a device at the same time.

    If your client is developing the firmware of the slave, they can place holding registers into the 3xxxx - 4xxxx area. They don't need to follow the memory layout of the original Modicon devices.

    If one can afford diverging from the Modbus standard, it's even possible to increase the number of registers. In one of my projects, I was considering to use Preset Single Register (06) function as a bank select command. Of course, you can't call it Modbus anymore. But, the master can still access the slave using a standard library or diagnostics tools.