adccommunitymod (AutomationDirect) asked a question.

Click PLC MODBUS addressing oddity

Created Date: January 20,2016

Created By: GP-FBD

**** This post has been imported from our legacy forum. Information in this post may be outdated and links contained in the post may no longer work.****

Hello, Is this normal behavior? Let's take address DS1 (supposedly Modbus address 4 00001 according to the data view). Then let's try writing "1 " to it by sending a MODBUS instruction: 0x06 - Write single register 0x00 0x01 - Address 0x00 0x01 - Value Then go to the Data View and check what's going on... Hey! DS2 is the one that was set to a value of "1 "! If I want to set DS1 to 0, I need to write to address 4 00000. Is this expected behavior or am I doing something funky? Should the data view be showing 4-00000 for DS1, etc?


  • adccommunitymod (AutomationDirect)

    Created Date: January 20,2016

    Created by: Tinker

    As far as I know that is perfectly normal for Modbus, or in other words, Modbus addressing is weird!

    The seemingly arbitrary choice of 0 or 1 starting point seem to be a common problem. (It might not be arbitrary, but I don't know the reasoning behind it)

  • adccommunitymod (AutomationDirect)

    Created Date: January 20,2016

    Created by: franji1

    That is expected behavior. The Modbus Specification writers believed that all addressing starts at 1 (00001, 10001, 30001, 40001), but on the wire, the protocol will subtract 1 to make it 0-based in the physical packet.

    This was common in old Texas Instruments protocols where the first X was X1, C was C1, but in the opcode/protocol, the protocol id value was 1 lower than what the USER saw.

    End Users should never know or care what the actual bits on the wire are (how many people know ASCII? don't know, don't care). However, some End Users also know the low level bit protocol and get confused in the addressing. Hence, the "confusion ".

    Here's something interesting. What's the difference in addressing for reading Holding Register 4123 vs. 40123 vs. 400123? Answer: they are all the same. The leading digit in the address "4 ", is a "type " designator (i.e. Holding Register), not part of the actual address on the wire. The actual address on the wire is 122 (1 less than 123). That's Modbus!

    Expand Post
  • adccommunitymod (AutomationDirect)

    Created Date: January 29,2016

    Created by: GP-FBD

    Thanks for the reply. I guess this is one of those things that's known by everyone and that you only need to learn once since you'll have spent so much time debugging it that it sticks in your head :P

  • adccommunitymod (AutomationDirect)

    Created Date: January 20,2016

    Created by: GP-FBD

    Hello,

    Is this normal behavior?

    Let's take address DS1 (supposedly Modbus address 4 00001 according to the data view).

    Then let's try writing "1 " to it by sending a MODBUS instruction:

    0x06 - Write single register

    0x00 0x01 - Address

    0x00 0x01 - Value

    Then go to the Data View and check what's going on...

    Hey! DS2 is the one that was set to a value of "1 "!

    If I want to set DS1 to 0, I need to write to address 4 00000.

    Is this expected behavior or am I doing something funky? Should the data view be showing 4-00000 for DS1, etc?

    Expand Post