One must merely insure that both all units are set to the same byte order.Īs a rule of thumb, the family of a device’s microprocessor determines its endianness. Many RTU master and slave devices allow specific selection of byte order particularly in the case of software-simulated units. Given that the Modbus RTU message protocol is big-Endian, in order to successfully exchange a 32-bit datatype via a Modbus RTU message, the endianness of both the master and the slave must considered. This means that when a numerical quantity larger than a single byte is transmitted, the most significant byte is sent first.”īig-Endian is the most commonly used format for network protocols – so common, in fact, that it is also referred to as ‘network order’. “Modbus uses a “big-Endian” representation for addresses and data items. The Modbus protocol itself is declared as a ‘big-Endian’ protocol, as per the Modbus Application Protocol Specification, V1.1.b: Again, the results differ drastically from the original value of 123456.00:įurthermore, both a “byte swap” and a “word swap” would essentially reverse the sequence of the bytes altogether to produce yet another result:Ĭlearly, when using network protocols such as Modbus, strict attention must be paid to how bytes of memory are ordered when they are transmitted, also known as the ‘byte order’. Ordering the same bytes in a “C D A B” sequence is known as a “word swap”. When interpreted as an IEEE 744 floating point data type, the result is quite different: For example, ordering the 4 bytes of data that represent 123456.00 in a “B A D C” sequence in known as a “byte swap”. Therefore the most important consideration when dealing with 32-bit data is that data is addressed in the proper order.įor example, the number 123456.00 as defined in the IEEE 754 standard for single-precision 32-bit floating point numbers appears as follows: The affects of various byte orderings are significant. However, the IEEE standard has no clear cut definition of byte order of the data payload. Modbus itself does not define a floating point data type but it is widely accepted that it implements 32-bit floating point data using the IEEE-754 standard. It is within these 4 bytes of data that single-precision floating point data can be encoded into a Modbus RTU message. This implementation settled on using two consecutive 16-bit registers to represent 32 bits of data or essentially 4 bytes of data. Consequently, special considerations were required when implementing 32-bit data elements. The protocol itself was designed based on devices with a 16-bit register length. Such convenience does not come without some complications, however, and Modbus RTU Message Protocol is no exception. In essence, the protocol is the foundation of the entire Modbus network. The protocol itself controls the interactions of each device on a Modbus network, how device establishes a known address, how each device recognizes its messages and how basic information is extracted from the data. The point-to-point Modbus protocol is a popular choice for RTU communications if for no other reason that it’s basic convenience.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |