advertisement
from the Automation List department...
question on Modbus Holding register and input register data type
Communications systems and equipment. topic
Posted by Giri on 21 September, 2008 - 6:06 pm
Hi,
I am working on Modbus RTU and ASCII master device implementation. My understanding is that in Modbus protocol Holding register and input register uses 2 bytes for each register is this Modbus standard that every Holding register and input register should use only 2 bytes.

is there any possibility of devices using different sizes (1, 3, 4 etc… bytes) for the Holding register and input register.

another question is Modbus data in Holding register and input register read response will be always in big endian format only...


Posted by Issac on 21 September, 2008 - 6:55 pm
This answer involves Modbus RTU only

source: Modbus-IDA December 28, 2006 http://www.Modbus-IDA.org 1/51
MODBUS APPLICATION PROTOCOL SPECIFICATION V1.1b

page 15:
6.3 03 (0x03) Read Holding Registers
The register data in the response message are packed as two bytes per register, with the binary contents right justified within each byte. For each register, the first byte contains the high order bits and the second contains the low order bits.

page 16:
6.4 04 (0x04) Read Input Registers
The register data in the response message are packed as two bytes per register, with the binary contents right justified within each byte. For each register, the first byte contains the high order bits and the second contains the low order bits.
-----------------

2) 4.2 Data Encoding
• MODBUS uses a 'big-Endian' representation for addresses and data items. This means
that when a numerical quantity larger than a single byte is transmitted, the most
significant byte is sent first. So for example
Register size value
16 - bits 0x1234 the first byte sent is 0x12 then 0x34

Until I searched for it, I was unaware that the Spec addressed format (data encoding). To my recollection, the original big vs little endian situation was due to some difference in Motorola vs Intel peripheral IC's, but I could be mistaken. Neither is showstopper nowadays.

Having something other than 2 bytes per register is a show stopper.

The spec says two bytes per register.

Use as many bytes per register as you want, but don't call it Modbus.

Issac


Posted by giri babu on 23 September, 2008 - 2:09 am
Hi Issac,

Thank you very much for your reply. It is clear now for me.


Posted by Michael Griffin on 23 September, 2008 - 1:35 am
If you use a register size of other than 2 bytes, it isn't Modbus. Any standard Modbus slave your master tries to talk with won't understand the protocol. However, there are a few non-standard implementations such as Enron Modbus, that have 4 byte registers in addition to 2 byte registers.

As for byte order, the spec is clear on what this should be. The problem arose because Intel designed their microprocessors backwards from nearly everyone else. It's not what is stored in the system's RAM that matters. It how it goes out on the wire that would affect anything else. Modbus uses what is also commonly called "network" order, because nearly all network protocols work this way.


Posted by Fred Loveless on 23 September, 2008 - 2:20 am
A single register is defined as 2 bytes, signed or unsigned data. IEEE Floats an signed or unsigned 32 bit data will be 4 consecutive bytes or 2 register locations. For those devices that support Double precision floats (64 bit data) ther will be 8 bytes or 4 registers.

That is for true Modbus RTU or Enron Modbus RTU devices.

There are a large number of devices that say they are Modbus because the protocol they use started out as Modbus. These are really Modbus-like. Typically the designers of these devices have chosen to alter the normal Modbus protocol to fit it to the unique requirements of their devices.

Fred Loveless
Senior Application Engineer
Kepware Technologies
http://www.kepware.com


Posted by Glen on 23 September, 2008 - 9:45 am
There is a modified Modbus specification designed by Enron Corporation that uses 32-bit registers for floating point numbers and 32-bit integers as well as 16-bit registers for 16-bit integers.

Since this specification also supports reading historical values and events that standard modicon modbus does not, it is still in use.

See www.simplymodbus.ca/Enron.htm for more information on Enron Modbus.

Your use of this site is subject to the terms and conditions set forth under Legal Notices and the Privacy Policy. Please read those terms and conditions carefully. Subject to the rights expressly reserved to others under Legal Notices, the content of this site and the compilation thereof is © 1999-2014 Nerds in Control, LLC. All rights reserved.

Users of this site are benefiting from open source technologies, including PHP, MySQL and Apache. Be happy.


Fortune
Sex without love is an empty experience, but, as empty experiences go,
it's one of the best.
-- Woody Allen
Advertise here
Advertisement
our advertisers
Help keep our servers running...
Patronize our advertisers!
Visit our Post Archive