Modbus Configuration: Registers Table


Thread Starter


I do not have experience with programming, so I may be way off with this (and the grammar). Please give me advice and/or articles I can read to help me better understand this topic. Also, can you explain and/or provide me with information on the differences between the parameters: shorts, floats, longs, bytes, binary, and doubles?

The device is reading incorrectly with the current setup.

The byte order in the monitor is defaulted as BADC, but may be changed. I am using 32 bit floating points and shorts as my parameters. The main thing I am trying to read is an output value for the level of odorant.

We were advised to use the conversion code 67 for the floating points, but I'm not sure if that is right.

I can provide more information as needed. Thank you.

there is so much Modbus information, that it is tough to learn all there is about the subject over a blog. I am by no means an expert, but I have worked with it for many years.

First question is what systems are talking together via Modbus? each vendor has their own quirks with Modbus.

A few quick things on Modbus. You are correct in asking about the different parameters. Each Modbus register (or location) represents 16 bits or 2 bytes. the register can be divided up into 16 sections. For example: you can count from location 30001.0 to 30001.15. so you can pack 16 Booleans on 1 register location. Shorts should be 1 byte = 1 register. Longs should be 2 bytes = 2 register. Floats should be 2 bytes = 2 registers. (Note: fact check me on the length of those).

Another thing to note. There are 4 categories of Modbus communication. Each with their own range of addresses.
00001-09999 - Input coils (this is read only Booleans. each address is a different Boolean. you can't have 08572.15)
10001-19999 - Holding Coils (this is read & Write Booleans. each address is a different Boolean. you can't have 18342.15)
30001-39999 - Input registers (this is read only registers. you can have shorts, longs, floats, Booleans here)
40001-49999 - Input registers (this is read& write registers. you can have shorts, longs, floats, Booleans here)

There is SOOOOO much more to learn, but that may get you a basic start.

for more reading, I check out
Data types/formats
There are four IEEE784 formats for 32bit floating point (real) values (a value with some number of digits to the right of the decimal point).

A 32 bit word consists of eight 8 bit bytes. A Modbus register, frequently called a 'word' in Modbus vernacular, is 16 bits.

If one reads the floating point value from left to right, the bytes are numbered 1, 2, 3, 4.

The 'standard' format is 4, 3, 2, 1 or D, C, B, A (using your letters) or Big Endian (most significant word and most significant byte first).
The often called 'swapped' format is 2, 1, 3, 4 or B, A, C, D (Little Endian, least significant word first, byte swapped)

Those two formats are very common and historically come from the different formats used by Motorola and Intel microprocessors to handle 32 bit data.

If your master/client is reading the value it will be immediately evident whether the master/client is correctly interpreting the format correctly because interpreting a value using the wrong format will produce a number that is completely whacko. For instance, if the real value is 17.83, the wrong format will be some bizarre value like -4.39991^16.

Every legitimate commercial master/client has some kind of setup selection that allows one to pick one of the two major FP formats the master will use to interpret 32 bit floats with. You'll have to poke around to find the selection choice.

Here's SimplyModbus's summary of data formats or data types of other data types

I don't know what you mean by "using shorts as my parameters'. That doesn't compute.

I would think a 'short' might be a single register 16 bit integer, but how that relates to your parameters, I don't know.

Likewise, I have no clue what 'conversion code 67' is, most likely a proprietary function for a specific software/firmware package.

In order to help, it helps if you provide
- what your device is (brand model)

- what the hardware link is (RS-485 or Ethernet)

- what your master/client software is

- what you are actually seeing, actual values that you're trying to read or that appear and the parameter values you're using to get there.

- links to the manuals, because there's a zillion Modbus devices and even those with lots of experience only see a fraction of market.
Modbus is a register based communication protocol. Whether you are transmitting bits, bytes, words,... you are always transmitting a number of 16 bit registers. A single precision floating point uses 32 bits or 2 16-bit registers, a double precision floating point uses 64 bits or 4 16-bit registers.

Since you're talking about 'conversion code 67' I assume you are probably using a Emerson device. Unfortunately they use their own interpretation of Modbus. For floating point you should use a conversion code to make it work according to Modbus specs.

Code 65: ABCD
Code 67: BADC
Code 69: CDAB
Code 71: DCBA
Thread starter Similar threads Forum Replies Date
O Modbus 0
D Modbus 1
M Modbus 2
S Modbus 1
M Modbus 2