A program has this line:
mb_status = MODBUS(3, -1, mbh, $04, addr, 40001, 1, 1)
That is for reading the value from the server device. The syntax is value = MODBUS(3, slot, handle, modbus function code[, parameters])
4 is Read Input Registers, so the value of the Start Address must be something between 0 and 9998. Input Registers in a PLC will be 10001 - 19999 but we do not use the 10000 base, we start at 0.
It shows a start address of 40001 but that will be for Holding Registers which is function 3. Again, do not use the 40000 base, just start at 0.
So the command should be this:
mb_status = MODBUS(3, -1, mbh, $03, addr, 0, 1, 1) ' the value from holding register 40001 will be put in VR(1)