I have implemented the ArduinoModbus library in my project but found out, that it is limited to the register range of 0-9999. Unfortunately I have to address registers above that.
I need extended register referencing with six digits Modicon notation. Can someone give me a hint if there is an Arduino Modbus library capable to do so?
But when using the mentioned Lib I have to add the function code (4) in front of the 16 bit address. The results is a Modicon address which is bigger than an integer.
My question is, if there is a Modbus Slave Lib which can handle 16 bit register definitions plus function code.
You can simply define a register with the address 20481 and it will be a holding register as you intend.
I can define a register with the address 20481, but unfortunately this Modbus Lib interprets the leading "2" as function code. This register will not be addressed when a master requests 20481 with function code 4- I have tried it. I could access it as register 0481 with a function code 2.
if(funcType == READ_DI) startreg += 10001; else startreg += 1;
if(funcType == READ_AI) startreg += 30001; else startreg += 40001;
_device->set(reg + 1, val);
_device->set(reg + 40001, val);
Hi Pylon, did you test these changes with an Arduino and a Modbus Master like ModbusView?