KFMH Electromagnetic Flowmeter Modbus Communication Protocol LS
KFMH Electromagnetic Flowmeter Modbus Communication Protocol LS
(Version number:LMAGMODRTUV77)
2013.6.14
L-MAG Electromagnetic Flowmeter Standard MODBUS Communication Protocol
Catalogue
1. Introduction........................................................................................................... - 2 -
2. L-mag network structure and wiring..................................................................... - 2 -
3. RTU frame format of modbus protocol................................................................. - 3 -
1) Master order frame structure...........................................................- 3 -
2) Slave response frame structure........................................................- 3 -
4. Code definition of MODBUS protocol order........................................................- 4 -
5. MODBUS register definition of electromagnetic flowmeter................................ - 5 -
1) MODBUS register definition of electromagnetic flowmeter.......... - 5 -
2) PLC address set illustration............................................................. - 5 -
6. Communication data analysis................................................................................- 7 -
1) Read instantaneous flow.................................................................. - 7 -
2) Read instantaneous velocity.............................................................- 8 -
3) Read cumulative flow.......................................................................- 9 -
4) Read instantaneous flow unit........................................................ - 10 -
5) Read the unit of the total amount of flow......................................- 10 -
6) Read alarm status...........................................................................- 10 -
Remark: The routine of this protocol’s application example only provide reference.
Some parameters in the routine are different from the address definition of MODBUS
register. Please subject to the address definition of MODBUS register.
-1-
L-MAG Electromagnetic Flowmeter Standard MODBUS Communication Protocol
1. Introduction
Resistor
Device Function
Start Data CRC Stop
address code
Remark:
T1-T2-T3-T4 is start or stop frame. MODBUS protocol sets that every two
frames must have 3.5 char delay at least. It is shown in figure-4.
Table-1
Function code name function
-4-
L-MAG Electromagnetic Flowmeter Standard MODBUS Communication Protocol
flowmeter
Table-2
Protocol
Protocol Addresses
Addresses Data format Resister definition
(HEX)
(Decimal)
Instantaneous flow
4112 0x1010 Float Inverse
float representation
Instantaneous velocity
4114 0x1012 Float Inverse
float representation
Float representation of the
flow percentage
4116 0x1014 Float Inverse
(reservation for
battery-powered
Floating representation of
4118 0x1016 Float Inverse
fluid conductivity ratio
Integer part of the cumulative
4120 0x1018 Long Inverse
positive value
Decimal part of the
4122 0x101A Float Inverse
cumulative positive value
Integer part of the cumulative
4124 0x101C Long Inverse
negative value
Decimal part of the
4126 0x101E Float Inverse
cumulative negative value
Instantaneous flow unit
4128 0x1020 Unsigned short
(table-3)
Cumulative total units
4129 0x1021 Unsigned short
(table-4 or table-5)
If there isn’t function code setting options when we configure PLC, you should
-5-
L-MAG Electromagnetic Flowmeter Standard MODBUS Communication Protocol
add 3 in front of register address when you use function code 04. If PLC register
address’s basic address is from 1, you should add 1 to original address when
configuring register address.
Example: L-mag electromagnetic flowmeter MODBUS register address is
4112(0x1010) and MODBUS function code is 4. So PLC register address is 34113.
The detailed configuration is seen in example chapter 2.
3) Address configuration illustration of KingView software
There isn’t option of configuring function code. Different drivers have different
configuration methods.
Take PLC- Modicon-MODBUS (RTU) driver for a example. You should add 8 in
front of register address when using function code 04. KingView register address’s
basic address is 1, so the original address should be added 1 when configuring
KingView register address.
L-mag electromagnetic flowmeter MODBUS register address is 4112(0x1010)
and MODBUS function code is 4. So PLC register address is 84113.
The detailed configuration is seen in example chapter 4.
4) Illustration of data’s meaning
Float format:
L-mag electromagnetic flowmeter MODBUS uses IEEE754 which is 32 bits
float format. Its structure is shown as follows: (take Instantaneous flow for a example)
0X1010(34113) 0x1011(34114)
V (1) S 2 ( E 127) (1 M )
-6-
L-MAG Electromagnetic Flowmeter Standard MODBUS Communication Protocol
Code 0 1 2 3
Code 0 1 2 3 4 5
Cumulative unit L L L M3 M3 M3
Code 6 7 8 9 10 11
Cumulative unit T T T USG USG USG
Alarm
Upper limit alarm, lower limit alarm, empty pipe alarm, system alarm:
0 ------ No alarm; 1------ Alarm
-7-
L-MAG Electromagnetic Flowmeter Standard MODBUS Communication Protocol
Float: C4 1C 60 00
1100 0100 0001 1100 0110 0000 0000 0000
float byte 1 float byte 2 float byte 3 float byte 4
S=1: if mantissa symbol is 1, it is a negative.
E=10001000: Exponent is 136
M=001 1100 0110 0000 0000 0000, The mantissa is :
1 1 1 1 1
V (1)1 2(136 127) (1 )
8 16 32 512 1024
= -625.5
2) Read instantaneous velocity
Float: C1 B0 80 00
1100 0001 1011 0000 1111 1000 0000 0000
S=1
E= 10000011
M= 011 0000 1111 1000 0000 0000
1 1 1
V (1)1 2(131127) (1 )
4 8 256
= -22.0625
-8-
L-MAG Electromagnetic Flowmeter Standard MODBUS Communication Protocol
Float: 3F 00 00 00
0011 1111 0000 0000 0000 0000 0000 0000
S=0
E= 0111111 126
M= 000 0000 0000 0000 0000 0000
-9-
L-MAG Electromagnetic Flowmeter Standard MODBUS Communication Protocol
- 10 -
L-MAG Electromagnetic Flowmeter Standard MODBUS Communication Protocol
- 11 -