![Longrun LRF-3000S Скачать руководство пользователя страница 51](http://html1.mh-extra.com/html/longrun/lrf-3000s/lrf-3000s_user-manual_1938702051.webp)
LRF-3000S Ultrasonic Transit-time Flow meter
- 50 -
1 byte
1 byte
1 byte
N*x2 byte
2 bytes
0x01 ~ 0xF7
0x03
2xN*
N*x2 ( Data )
CRC ( Verify )
N* = Data register number
3.
MODBUS Protocol function code 0x06 usage
The host sends a command to write a single register information frame format ( function code 0x06 ):
Slave Address
Operation
Function Code
Register Address
Register Data
Verify Code
1 byte
1 byte
2 bytes
2 bytes
2 bytes
0x01 ~ 0xF7
0x06
0x0000 ~ 0xFFFF
0x0000 ~ 0xFFFF
CRC ( Verify )
The slave returns the data frame format ( function code 0x06 ):
Slave Address
Operation
Function Code
Register Address
Register Data
Verify Code
1 byte
1 byte
2 bytes
2 bytes
2 bytes
0x01 ~ 0xF7
0x06
0x0000 ~ 0xFFFF
0x0000 ~ 0xFFFF
CRC ( Verify )
The range of flow meter addresses 1 to 247 (Hexadecimal: 0x01 ~ 0xF7 ), and can be checked in the Menu 46.
For example, decimal number "11" displayed on Menu 46 means the address of the flow meter in the MODBUS
protocol is 0x0B.
The CRC Verify Code adopts CRC-16-IBM (polynomial is X
16
+X
15
+X
2
+1, shield character is 0xA001) which is
gained by the cyclic redundancy algorithm method. Low byte of the verify code is at the beginning while the high
byte is at the end.
For example, to read the address 1 (0x01) in the RTU mode, if the instantaneous flow rate uses hour as a unit
(
m3/h
)
, namely reads 40005 and 40006 registers data, the read command is as follows:
0x01
0x03 0x00 0x04
0x00 0x02
0x85 0xCA
Flow meter Address Function Code First Address Register Register Numbers CRC Verify Code
Flow meter returned data is (assuming the current flow=1.234567m
3
/h)
0x01
0x03
0x04
0x06 0x51 0x3F 0x9E 0x3B 0x32
Flow meter Address Function Code Data Bytes Data
(
1.2345678
)
CRC Verify Code
The four bytes 3F 9E 06 51 is in the IEEE754 format single precision floating point form of 1.2345678.
Pay attention to the data storage order of the above example. Using C language to explain the data, pointers can be
used directly to input the required data in the corresponding variable address, the low byte will be put at the
beginning, such as the above example 1.2345678 m/s, 3F 9E 06 51 data stored in order as 51 06 9E 3F.
For example, it converts the address 1 (0x01) to 2
(
0x02
)
under the RTU mode, so to write the data of flowmeter
44100 register as 0x02, the write command is as follows:
0x01
0x06
0x10 0x03
0x00 0x02
0xFC 0xCB
Flow meter Address Function Code Register Address Register Number CRC Verify Code
Flow meter returned data is: