Replies: 2 comments 1 reply
-
Hi, According to the Modbus spec there technically is no Register 0 or coil 0 ... however many vendors don't implement their protocol-stack correcly according to this spec. If you read Coil 1, all addresses are sent over the wire as x-1 ... so 1 becomes 0 ... please try if simply adding 1 to all your addresses gives you the results you're looking for. |
Beta Was this translation helpful? Give feedback.
-
I agree, c that this seems odd for us IT folks. However what do you think would happen, if we removed that check? We'd be sending -1 on the wire. |
Beta Was this translation helpful? Give feedback.
-
I'm using PLC4j's Modbus-TCP implementation to communicate with a Siemens S7-200 PLC. The PLC addresses memory locations starting at 0, but PLC4j requires addresses to start at 1 when adding register items. This prevents me from reading address 0 in the PLC.
While other PLC brands may start addressing at 1, Siemens PLCs start at 0. So I believe the address checking in the addItem() method is not appropriate in this case.
Is there a way to configure PLC4j to allow starting register addresses at 0 instead of 1? Or alternatively, is there a way to disable the address validation check so I can specify address 0? I need to be able to read the full range of PLC memory including location 0.
Beta Was this translation helpful? Give feedback.
All reactions