MODBUS Digits Address Confirmation of Understanding

W

Thread Starter

wowylied

Hi.

For a project i had to implement to MODBUS protocol (Rtu and ascii) in a custom software. I used the website http://www.simplymodbus.ca/index.html to help myself understanding it.

But after coding it someone asked me the question "do you use 6 digits address?" and now i am lost. I had no knowledge about this.

In my understanding after reading some posts here (correct me please if i am wrong) the requests frames will not change if the address are 4, 5, 6 digits, nor will the answer frames. but i will still have to take into account the kind of address when i am decoding the answer.

For example in the case of the function 01 (http://www.simplymodbus.ca/FC01.htm), is the request always this whatever the kind of address:
11 01 0013 0025 0E84

0013 being 0013 understood by the target as 0013 in 4 digits 10013 in 4 digits and 100013 in 6 digits.

This is the first time i am working on this protocol and this is really the only part where i can't seems to find much information about it.

Thank you for your answers!
 
We humans need conventions to help us deal with binary. Hexadecimal is an example of a short hand representation of a binary string in a shorter form.

The leading numeral (4) for holding register identification is a convention used by humans to help identify the value as being in a holding register; the leading numeral (4) is not part of the Modbus PDU packet or message.

The actual Modbus data value is 16 bits, FFFF hex, or a value up to 65535 decimal.

Early model PLCs and HMIs were limited by memory size (remember how the IBM DOS O/S maxed out at 640K RAM memory?) so the early Modbus implementations allowed for '5 digit' addressing from (4)0001 decimal to (4)9999 decimal.

As memory capacity has increased, it became prudent to increase the useable addressable range of registers.

6 digit addressing covers the range up to (4)FFFF hex, or (4)65535 decimal (4)65535 is 6 digits, even though one isn't used at all and the Modbus message is binary, not decimal.

I've seen a minor correlation between 5 digit addesses being used for zero based addressing in hex, (4)FFFF and 6 digit addressing being used for 1 based addressing in decimal (4)65535, but there's always exceptions; so many implementations, so many arbitrary choices . . . .

5 digit addressing is disappearing as time requires replacement with the current trend of 6 digits.

Where you need 6 digit addressing is with registers greater than 9999 decimal (270F hex)

A (4)13442 decimal address (3842 hex) won't work when the available software uses 5 digit addressing, but it will for 6 digit (3842 hex is less than FFFF hex)

Your example of 0013 as the indexed address would work for either 5 or 6 digit schemes. No magic numeral ones needed anywhere.

If your implementation covers the range from 0000 through FFFF hex, then you're good.
 
Top