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.
Is it even possible to write in those registers? Thanks in advance
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.
Your answer helped me to find what I was doing wrong. As you said, there are 65536 input registers. The restriction of being between 3xxxx and 4xxxx is just a convention... they can do whatever they want. So I'm able to write in 30120 using function fx03. Thanks!
If you say that a 3xxxx address is a Holding Register I and many others would say that you are wrong.This has a cleaner solution. Schneider, the current owner of Modicon, and other manufacturers too, to exceed the 9999 register limit now use 6-digit addresses like 4xxxxx instead of 4xxxx, so there is no need to skip Modbus addressing rules. In the last Modbus driver I wrote I also used 6-digit addresses
I agree with you Lluis. But this is my very first project using Modbus and I didn't develop the slave... I was given a set of addresses I have to read/write and If they don't want to follow the Modicon protocol is not in my hand... And belive me it sucks because it took me more time to realize what they were asking for. Modicon protocol should be followed by everyone