Modbus addressing models

F

Thread Starter

Fred Wedemeier

The Modbus application protocol spec defines a 16-bit address plus a number of function codes to direct that address to one of several data types.

It's also apparent that the upper digit of a decimal address is used to indicate data type. Quoting from one user manual, "Notice that the Modbus protocol uses a 5-digit representation for the slave data address which infers the point-type. For example, INPUT STATUS values are always represented in the range 10001-19999: HOLDING REGISTERS are displayed as 40000-49999...." Examining user guides for several instruments shows that all do indeed use addresses in the 4xxxx range for holding registers.

Where is the usage of the upper digit specified?

I cannot locate it in any of the Modbus specs, and the Application spec even states that mapping is "totally vendor device specific."

If usage isn't specified but is done by convention, could someone please clue me in to the convention?

Thx!

fcweed at mail. com
 
M

Michael Griffin

The Modbus *protocol* doesn't use any numerical prefixes to indicate data type. Modbus just numbers addresses from 0 to 65535 in 16 bit natural binary for each data type. You select the appropriate data type according to which read or write function code you use.

Some *applications* use a numerical prefix in their user interface. This seems to be something that has arisen through convention (Modicon used it in their programming software and PLC manuals). It has nothing to do with what goes out over the wire in the actual protocol though. They could just as easily have used "I", "Q", and "V" in their manuals for all the difference it would have made.

The actual protocol documents describe the data types as Discrete Inputs, Coils, Input Registers. and Holding Registers. I haven't seen anything about numerical type prefixes anywhere in the Modbus standards documents that I have read.

So far as I know, the convention is 0 = Coils, 1 = Discrete Inputs, 3 = Input Registers, and 4 = Holding Registers. Note though that these numbers are not actually part of Modbus.
 
Hello,

>Where is the usage of the upper digit specified?

I do not want to be pedantic.

On the first line/paragraph of the MODBUS specification, PI-MBUS-300, for each function code, 1,2,3,4,5, etc., is defined the area of memory and type of memory the function accesses.

MODBUS APPLICATION PROTOCOL SPECIFICATION V1.1a might help.

The 0,1,3,4 etc. is how a Modicon controller referred to an area and type of memory when the protocol/spec was created.

The size of the different device memory areas is device specific. Look in the device documentation for memory size and type mapping.

So, the spec was written referring to Modicon controllers. The function codes are what defines the data type and how to access it. It really could all point to the same memory area.

The original protocol documents do not refer to the first digit in the description of the functions. It refers to the name of the area. (Holding Register, Coils, etc)

The first digit could be any digit.

HTH,

Mark
http://www.peakhmi.com/
 
You can think of 10051, 30034, 40021, etc. as register 'Names'. You can subtract an offset from the 'Name' to get the register number or address.

For example, the 40000 block uses an offset of 40001. 40021 - 40001 = register 20 (14 in hex). The actual code uses hex 14 to specify the 20th register and a function code to specify which block of data (the 40000 block). Some systems use a 6 digit naming convention, 400001, but the code is the same.

This is explained further on the web page http://www.simplymodbus.ca/FAQ.htm
 
Top