Data addressing in slave device

J

Thread Starter

Joe Bushmeyer

I am looking for some guidance on how to describe the data addresses in my slave device. I am making data available to the Modbus master only via function 3.

My first piece of data is available at the zero-based address 0000. I have seen the following representations of this address:

Generic 0-based address: 0000
Generic 1-based address: 0001
Modicon 5-digit address: 30001
Modicon 6-digit address: 300001

What is the preferred form to give to my address map? Are these descriptions accurate and generally accepted?

Thanks in advance,
Joe
 
F

Frank O'Gorman

I would definitely go for 0-based addressing.

Anything else invites confusion since you would have two addresses for each register, one in the documentation and a different one actually sent in messages.

If you you really want to use the Modicon convention, you should use '4' at the beginning for holding registers, not '3' - the Modicon "prefixes" don't match the function codes!
 
D

Darrin Hansen

Actually, it depends on where you are viewing the "address" you indicated (on the wire or in the master or slave itself). Most (properly-coded) masters will decrement the requested index by 1 prior to placing the request on the wire. What this means is that in most masters, if you ask for holding register 1, then look at the packet on the wire, you will see 0. Commonly, slaves then add the 1 back on again to recover the original request (but this depends on the slave's internal implementation).

So in summary, most masters allow the minimum targeted index value to be 1. This equates to 0 on the wire.

As for documenting the "40" part for holding registers, this is kind of all over the board and no real standard exists. One good way to get around it is to document your registers as "offsets" (from the 4X holding register or 3X input register base). Then you can document them as 0001, etc.
 
One plausible way of handling documentation is by specifying Modicon vs Modbus. For example, "Modicon Register 40010 is Modbus Register 9" etc.
 
Personally, I prefer the generic zero based address, because it's what Modbus actually uses. If you understand anything about the Modbus protocol then its the easiest to remember because you don't have to mentally translate it into another format that exists only for documentation purposes. Other people though may prefer some other way because its' what they are used to, or it's what their other equipment uses, or for some other reason.

However, no matter what you do the possibility of confusion exists, so you should include a brief note explaining that "0" addresses the first holding register, "1" addresses the second holding register, etc.

I've seen some equipment documented with tables, where they listed several common conventions using different columns.
 
I would list it in 2 ways, as modbus address 40,001... But also list Function Code 3, Address 0000 hex.

This covers most of the addressing setups for a master. If you want you can throw in the 400,001 addressing, but many 6 digit addressing users know how to convert the 5 digit address to the 6 digit number.
 
Top