beautypg.com

2 modbus telegram format, 3 data types in modbus, Modbus telegram format – KROHNE MFC 010 C Converter User Manual

Page 22: Data types in modbus

background image


20

MFC010 Interface Manual

5.2

Modbus Telegram Format

The messages between the Modbus master and slave devices are transmitted as groups of characters,

as des cribed abov e, c ollectively k nown as t elegrams. E ach t elegram i s preceded and followed by a

“Quiet” period on t he Modbus bus of 3½ character periods. T he “Quiet” period following the telegram is

used to indicate the end of the telegram.

The first character received in the telegram identifies the slave device to which or from which the telegram

is bei ng t ransmitted. T his f irst c haracter i s k nown as t he S lave I D or S lave A ddress. In multidrop

configurations (see Section 5.4 below) this address character is used by the master device to individually

communicate with one of the instruments on the bus connection. The Slave device returns this value to

indicate to the master the source of the response telegram. The Slave Address value for the MFC010 can

be set using Holding register No. 1006 (see Section 7.5).

The second character received in the telegram is the function command code requested by the master

device. A list of the function codes supported by the MFC010 can be found in Section 6 (See Page 23)

along with a description of each.

The last two characters received form a 16 -bit checksum value. This checksum value is used to ensure

that t he dat a r eceived i n t he t elegram has not been c orrupted. T he c hecksum i s calculated and

appended to the telegram by the transmitting device (Slave or Master) and the receiving device compares

the received checksum value against the value it calculates from the received data. If the data has been

corrupted in some way during transmission, then the checksum calculated by the receiving device will be

different than that which it received with the telegram. The receiving device will then ignore the telegram

knowing t hat t he dat a w ithin i s unr eliable. S ee A ppendix A for information on the Modbus Checksum

calculation.

Between the function code character and t he CRC checksum at the end of the telegram is the telegram

data. The contents and format of these data characters is dependant upon the function code requested.

5.3

Data Types in Modbus

There are two data types used to transmit information on a Modbus data bus, the “Bit” and the “Register”.

The “Bit” represents a single binary state, whether as an output or an input condition. The “Register” is a

16-bit integer transmitted as two 8-bit characters. U sing multiple “Registers” the Modbus interface can

transmit higher accuracy values such as “Floating Point” and “Double Precision Floating Point” numbers.

“Bit” variables are packed into 8 bit bytes, so each character sent or received can contain up t o 8 “ Bit”

variables. The Master and Slave devices use only as many 8 bit data characters as are required to

transmit the information. Any unused bits in the data characters are ignored. The bit that is first indexed

by the Master request address is transmitted in the LSB, Bit 0, of the first data character. The next “Bit”

value i s t ransmitted i n t he nex t bi t, B it 1, of t he f irst dat a c haracter. T his c ontinues until the last bit

location, Bit 7, of the first data character is used. The next “Bit” value is then transmitted in the LSB, Bit 0,

of the following data character, this continues until all of the requested values have been transmitted. Any

unused bit locations in the last data character are filled out with “0”s

For simple single register variables the Most Significant Character of the register is transmitted first, with

the Least Significant character following immediately after. H owever, for variables that require multiple

registers, i.e. the “Floating Point” and “Double Precision Floating Point” variables, the transmission order

is a little more complicated. i.e.