You are on page 1of 3

Ultrasonic Level Transmitter of the Modbus protocol

Modbus network using RTU (Remote Terminal Unit) mode。

Coding System
Eight-bit binary, hexadecimal 0 ... 9, A ... F
Two hexadecimal characters contained in each eight-bit field of the message
Bits per Byte
1 start bit
8 data bits, least significant bit sent first
no bit for no parity
1 stop bit if parity is used
Error Check Field
Cyclical Redundancy Check (CRC)

The default baud rate is 4800

Function 03 (03hex) Read Holding Registers


Read the binary contents of holding registers in the slave.

Request
The request message specifies the starting register and quantity of registers to be read.

Data using the 32-bit IEEE-754 floating-point format


Register definition table (note: the register address coding for hexadecimal)

the the
Read Read
register instructions register instructions
-only -only
address address

0000 None 0001 None

Liquid level Liquid level


0002 (The previous two bytes √ 0003 (The latter two bytes √
of IEEE-754 floating-point) of IEEE-754 floating-point)
Distance Distance
0004 (The previous two bytes √ 0005 (The latter two bytes √
of IEEE-754 floating-point) of IEEE-754 floating-point)
Temperature Temperature
0006 (The previous two bytes √ 0007 (The latter two bytes √
of IEEE-754 floating-point) of IEEE-754 floating-point)

0008 None 0009 None

Register address 0002H level value, 0004H emptying height value, 0006H temperature (4 bytes per data, 2
registers, data type is REAL4, IEEE754 floating-point format)
For Example:
Sample 1:
Request level data from Meter No. 1, query data frame is as below
Cyclic Cyclic
Data Start Data Start Data Read Data Read Redunda Redunda
Address Address Number Number ncy ncy
Address Code
Register Register Register Register Check Check
High Bytes Low Bytes High Bytes Low Bytes Low High
Bytes Bytes

01H 03H 00H 02H 00H 02H 65H CBH

Meter No.1 Level value at register 0002H address Two registers needed to read a level data

Response data frames include slave addresses, function codes, number of data and CRC error checking.
If the level data is 3.567m, the corresponding data are as follows:
CRC Low CRC High
Address Code Bytes Level Data Level Data Level Data Level Data
Bytes Bytes

01H 03H 04H 40H 64H 49H BAH 18H 0FH

Meter No.1 Level data 4 bytes

Note: 0x406449BA is the floating point number of 3.567m level data

Sample 2:

Request level value and altitude data from Meter No. 2


Cyclic Cyclic
Data Start Data Start Data Read Data Read Redunda Redunda
Address Address Number Number ncy ncy
地址 功能码
Register Register Register Register Check Check
High Bytes Low Bytes High Bytes Low Bytes Low High
Bytes Bytes

02H 03H 00H 02H 00H 04H E5H FAH

Meter No.2 Data Start Address 0002H Four registers needed to read level and altitude.

Response data frames include slave addresses, function codes, number of data and CRC error checking.
If the level is 3.567m and the altitude is 1.433m, the corresponding data are as follows:
CRC CRC
Addres altitud altitud altitud altitud
Code Bytes Level Level Level Level Low High
s e e e e
Bytes Bytes

02H 03H 08H 40H 64H 49H BAH 3FH B7H 6CH 8BH BDH B2H

Meter No.2 The level and altitude data are 8 bytes in total.
IEEE754 floating-point format: It uses symbol bits to represent the number of symbols, order codes and
tails to represent the size of the number, with 24-bit accuracy. The high bit of the tail is always "1", so it is
not preserved. The distribution of bits is: 1-bit symbol bits, 8-bit exponential bits, 23-bit tail.

Symbol bits are the highest and the last 23 bits are the lowest. They are described in bytes as follows:

Address +0 +1 +2 +3

Content SEEE EEEE EMMM MMMM MMMM MMMM MMMM MMMM

Remark: S: symbol bit, 1 is negative, 0 is positive;


E: Order code (in two bytes) offset 127;
M: 23-digit tail number, the highest bit is "1".

You might also like