MODBUS Interface Description

110100010001010111000101001
101110101010100101010101010
010101010100011001010101000
010101010010101001010100000
010100011010010100000101011
100010100100000110010101010
010101000110100100101001001
110100010001010111000101001
101110101010100101010101010
010101010100011001010101000
010101010010101001010100000
010100011010010100000101011
100010100100000110010101010
010101000110100100101001001
110100010001010111000101001
101110101010100101010101010
010101010100011001010101000
010101010010101001010100000
MODBUS
Interface
Description
The Seametrics iMAG Modbus Interface
The Seametrics iMAG Modbus interface allows for the control, configuration, and monitoring of internal
functions and variables within the meter.
For configuration, the same parameters which are settable by the meter menu are also settable by Modbus
commands.
These menus are:
TUNIT This menu is used to select the units for displaying the contents of the totalizer. The selection is
comprised of the following:
MILLION IMPERIAL GALLONS
GALLONS
LITERS
GALLONS X 1000 KILO LITERS MILLION GALLONS MEGA LITERS
CUBIC FEET
CUBIC METERS CUBIC FEET X 1000 CUBIC METERS X 1000
MILLION CUBIC FEET
BARRELS
IMPERIAL GALLONS IMPERIAL GALLONS X 1000
RUNIT This menu is used to select the units for displaying the current computed rate. There are two parts
to this selection, units and the corresponding timebase. The units are as follows:
GALLONS
MEGA GALLONS
CUBIC FEET
IMPERIAL GALLONS
MEGA IMPERIAL GALLONS
LITERS
MEGA LITERS
CUBIC METERS CUBIC METERS X 1000
BARRELS
RUNIT TIME The timebase selection is as follows:
SECOND
MINUTE
HOUR
DAY
Seametrics Incorporated • 19026 72nd Avenue South • Kent, Washington 98032 • USA
(P) 253.872.0284 • (F) 253.872.0285 • 1.800.975.8153 • www.seametrics.com
SETP This menu is used to specify the amount of fluid measured, in the selected units, for emitting a
pulse output. As an example, if the rate is 1 gallon/sec., and SETP is 10 gallons, then one pulse is emitted
for every 10 gallons which are metered. This occurs once every 10 seconds. Note, also, that the units for
SETP correspond to the rate units, as opposed to the total units. The valid range of entered values spans
00000.0 to 99999.9.
DAMP This menu is used to select the amount of damping so as to stabilize the display of the rate. The
selection corresponds to a window, in seconds, over which averaging takes place. These windows, in turn,
are overlapped in time such that a new average value is computed every second. The selected range is
from 0 to 7, where 0 defines a window of 1 second, and 7 defines a window of 8 seconds.
SET4 This menu defines the rate corresponding to the 4 mA setting for the 4-20 mA loop. It specifies
the lower limit of the rate that will result in controlling 4 mA in the loop. The valid range of entered values
spans 00000.0 to 99999.9.
SET20 This menu defines the rate corresponding to the 20 mA setting for the 4-20 mA loop. It specifies
the upper limit of the rate that will result in controlling 20 mA in the loop. The result of defining the SET4
and SET20 limits is to scale the rate between these limits to the span between 4 mA and 20 mA. The valid
range of entered values spans 00000.0 to 99999.9.
SETF This menu defines the maximum frequency available at the high frequency output. This
frequency corresponds to Q4, the maximum flow rate for a given pipe diameter. The frequency
output is scaled between zero flow and Q4. The choices are:
500 Hz
1 KHz
2 KHz
5 KHz
10 KHz
Although not writeable, the Modbus interface also allows obtaining the contents of the INFO menu, as
follows:
BODY SERIAL NUMBER
BODY MODEL NUMBER
BODY FIRMWARE VERSION
HEAD FIRMWARE VERSION
Seametrics Incorporated • 19026 72nd Avenue South • Kent, Washington 98032 • USA
(P) 253.872.0284 • (F) 253.872.0285 • 1.800.975.8153 • www.seametrics.com
In addition to the contents of menu items, a variety of additional information is available to the Modbus
interface, as follows:
FLOW INFORMATION
FORWARD FLOW TOTAL
REVERSE FLOW TOTAL
RATE
CALIBRATION CONSTANTS
ZRADC
FSADC
These two points are part of a 2 point
calibration procedure
FLOWRATE LIMITS
Q4
CUTOFF
This corresponds to the maximum flow rate
This corresponds to the lowest measurable flow rate
METER PARAMETERS
STATUS
EXT VOLT
These reports communication failure and empty pipe
This reports value of external voltage used to power meter
This section presents the address space map corresponding to the above-described quantities. In connection with this we include information about the read/write capability as well as the data type. In this regard,
the following data types are possible:
Integer
Float
Double
String
16 bit unsigned quantity corresponding to 1 register address
32 bit IEEE floating point number corresponding to 2 sequential addresses
64 bit IEEE floating point number corresponding to 4 sequential addresses
16 ASCII characters correspond to 16 sequential addresses
When quantities are written to the meter, they are also stored in an internal EEPROM device. As such,
there is a limit as to how many times the device may be written. With this in mind, the write operation
should be used cautiously and sparingly.
Seametrics Incorporated • 19026 72nd Avenue South • Kent, Washington 98032 • USA
(P) 253.872.0284 • (F) 253.872.0285 • 1.800.975.8153 • www.seametrics.com
The Modbus function codes implemented for the iMAG consists of the following:
Function code
0x3
0x4
0x6
0x10
Description
Read Holding Register
Read Input Register
Write Register
Write Multiple Registers
For all read operations, either 0x3 or 0x4 may be used. For all write operation, either 0x10 or 0x16 may be
used.
The address space map, indicating addressable quantity, register address, read/write capability, and data
types, is as follows:
MODBUS ADDRESS SPACE MAP (Protocol Address, Base 0)
QUANTITYADDRESSR/WDATA TYPE
TUNIT
RUNIT
RUNIT TIME
DAMP
SETF
1000
1001
1002
1003
1004
R/W
R/W
R/W
R/W
R/W
INTEGER
INTEGER
INTEGER
INTEGER
INTEGER
STATUS5000R INTEGER
SET4
SET20
SETP
7000
7002
7004
R/W
R/W
R/W
FLOAT
FLOAT
FLOAT
FLOW RATE
TOTAL - FWD
TOTAL - REV
7006
7008
7010
R R R FLOAT
FLOAT
FLOAT
ZRADC
FSADC
CUTOFF
Q4
7012
7014
7016
7018
R R R R FLOAT
FLOAT
FLOAT
FLOAT
VOLTAGE
7020
R FLOAT
SERIAL #
MODEL #
LOWER FIRMWARE
UPPER FIRMWARE
6000
6008
6016
6024
R
R
R
R
STRING
STRING
STRING
STRING
Seametrics Incorporated • 19026 72nd Avenue South • Kent, Washington 98032 • USA
(P) 253.872.0284 • (F) 253.872.0285 • 1.800.975.8153 • www.seametrics.com
This section now describes the encoding – the numeric association - for each of the commands.
TUNIT Data value
Unit
0
GALLONS
1GALLONS X 1000 2
MILLION GALLONS 3
CUBIC FEET
4
CUBIC FEET X 1000 5
MILLION CUBIC FEET
6
IMPERIAL GALLONS 7
IMPERIAL GALLONS X 1000
8
MILLION IMPERIAL GALLONS
9LITERS
10KILO LITERS 11MEGA LITERS
12
CUBIC METERS 13CUBIC METERS X 1000
14
BARRELS
RUNIT Data value
Unit
0GALLONS
1MEGA GALLONS
2
CUBIC FEET
3IMPERIAL GALLONS
4
MEGA IMPERIAL GALLONS
5LITERS
6
MEGA LITERS
7CUBIC METERS 8
CUBIC METERS X 1000
9BARRELS
RUNIT TIME
Data value
Unit
0SECOND
1MINUTE
2
HOUR
3DAY
SETP
Data value
00000.0 – 99999.9
Unit
As specified by RUNIT
Seametrics Incorporated • 19026 72nd Avenue South • Kent, Washington 98032 • USA
(P) 253.872.0284 • (F) 253.872.0285 • 1.800.975.8153 • www.seametrics.com
DAMP Data value
Averaging Window (second)
01
1
2
2
2
3
4
4
5
5
6
6
7
7
8
SET4
Data value
00000.0 – 99999.9
Unit
As specified by RUNIT
SET20 Data value
00000.0 – 99999.9
Unit
As specified by RUNIT
SETF
Data value
0
1
2
3
4
INFO
Data value
0
1
2
3
Value
500 Hz
1
KHz
2
KHz
5
KHz
10
KHz
Selection
Body serial number
Body model number
Body firmware version
Head firmware version
STATUS
Data Bit
Selection
00
Communication OK
1
Communication failure
1
0
1
Pipe empty
Pipe full
Seametrics Incorporated • 19026 72nd Avenue South • Kent, Washington 98032 • USA
(P) 253.872.0284 • (F) 253.872.0285 • 1.800.975.8153 • www.seametrics.com
VOLTAGE
Data Bit
Value
Measured
external voltage
FLOAT
FLOW RATE
FORWARD TOTAL
REVERSE TOTAL
Data Bit
FLOAT
Value
The computed rate in units specified by RUNIT menu
Data Bit
FLOAT
ZRADC
Data Bit
FLOAT
Value
The current total volume in forward direction in
the unit specified by TUNIT menu
Value
The current total volume in reverse direction in the
unit specified by TUNIT menu
Value
A calibrated constant derived from calibration
procedure
Value
A calibrated constant derived from calibration
procedure
Value
The lowest measureable flow rate in gpm
Data Bit
FLOAT
FSADC
Data Bit
FLOAT
CUTOFF
Data Bit
FLOAT
Q4
Data Bit
FLOAT
Value
The maximum measureable flow rate in gpm
based on flow rate of 10 meters/sec and a given pipe
diameter.
Parameter Selections
In conjunction with the MODBUS interface, the meter menu system has provisions for defining the Slave ID
and communication parameters.
To get to these menus, move to the EXIT tab and tap the “UP” key 4 times. This will bring up another menu
page containing the tabs COMM, and MBID.
MBID is used to define the Slave ID and contains a 3 digit BCD numeric entry field.
Seametrics Incorporated • 19026 72nd Avenue South • Kent, Washington 98032 • USA
(P) 253.872.0284 • (F) 253.872.0285 • 1.800.975.8153 • www.seametrics.com
COMM is used to select the communication parameters as follows:
Baud RateParity
19200
19200
19200
9600
9600
9600
None
Even
Odd
None
Even
Odd
The default settings for these parameters are:
Slave ID:
1
Comm:19.2 KBaud, no parity
MODBUS Slave Installation
The iMAG meter supports a half duplex, RS485 network. In this regard, the interface contains an RS485
transceiver which implements a fail-safe receiver to assure that a mark condition will be sensed even
when the cable is disconnected or undriven. Under this condition, a bias network is unnecessary for the
iMAG interface to function properly. It is assumed, however, that the master contains either a Fail Safe
receiver or a bias network for proper operation of the RS485 network as whole. A useful reference on this
subject is an Applications Note from Texas Instruments: http://www.ti.com/lit/an/slyt514/slyt514.pdf
For attachment to the RS485 network, the iMAG comes equipped with a 6 conductor cable. For Modbus, the following connections are used:
Ground
B[-]
A[+]
White wire
Orange wire
Blue wire
The iMAG Modbus interface can work with network cable lengths up to 50 feet without termination. If a
longer cable length is used, then DC or AC termination may be needed on the iMAG if it is at the end of the
network. Under this condition consult the factory for further details if this option is needed.
Seametrics Incorporated • 19026 72nd Avenue South • Kent, Washington 98032 • USA
(P) 253.872.0284 • (F) 253.872.0285 • 1.800.975.8153 • www.seametrics.com
MODBUS Slave Response
Following the transmission of a Modbus command, the slave will either return a response indicating success, or with an exception code or timeout if there are any errors.
The conditions under which Exception Code of 4 is returned are as follows:
Invalid Address: An attempt has been made to write to a non-existent register.
Wrong number of registers: The data type implies that a certain number of registers need to
designated either for read or write operations. For example, if we wish to write a floating point
value then the number of designated registers must be modulus 2 since 2 registers are needed to
hold a floating point value. As an example, if a single floating point number is read, and only 1
register is specified for the quantity of registers, then a an exception code is sent.
Addressed registers contain mixed data types:
When multiple registers are either written or read, all the implied data types must be must be the same,
e.g, all floating point or all integers. If there is a mixture, then an exception code is sent.
Timeout The conditions under which a timeout results is as follows:
Wrong slave ID: An incorrect slave ID is designated.
Wrong COMM parameters: The baud rate and parity are incorrectly selected.
MODBUS Programming Examples
In this section, some typical programming examples are given for programming the iMAG meter through
the Modbus Interface.
For setup, total units, rate units, and rate units time base may be selected.
To program the total units for liters, we need to write the TUNIT register at address 1000 (0x03E8) with
a value of 9. To accomplish this, we can use the Write Single Register command (0x6) with the following
string. Note that bytes are indicated by the use of angle brackets.
Seametrics Incorporated • 19026 72nd Avenue South • Kent, Washington 98032 • USA
(P) 253.872.0284 • (F) 253.872.0285 • 1.800.975.8153 • www.seametrics.com
TUNIT:<01><06><03><E8><00><09><C9><BC>
To program the rate units for liters, we need to write the RUNIT register at address 1001 (0x03E9) with
a value of 5. To accomplish this, we can use the Write Single Register command (0x6) with the following
string.
RUNIT:<01><06><03><E9><00><05><98><79>
To program the rate units time base for hours, we need to write the RUNIT TIME register at address 1002
(0x03EA) with a value of 2. To accomplish this, we can use the Write Single Register command (0x6) with
the following string.
RUNIT TIME:<01><06><03><EA><00><02><29><BB>
As an alternative to writing each register individually with the Write Single Register command, the Write
Multiple Registers command (0x10) can be used to write all 3 registers in one command operation. The
following string can be used to write TUNIT, RUNIT, and RUNIT TIME registers. Note that a value of 0 is written to each register. This command will program total units in gallons, rate units in gallons, and time base
in seconds.
ALL COMMANDS:
<01><10><03><E8><00><03><00><78>
After setup, the meter can be monitored for the values of rate and total. This can be accomplished with
either the Read Holding Registers (0x3) or Read Input Registers (0x4) command. To read both quantities
in one operation, we can use the Read Input Registers (0x4) command with a starting address of 7006
(0x1B5E) and the quantity of registers of 4. Four registers are required since these are floating point numbers requiring 2 registers for each value. The following command string can be used.
FLOW RATE & TOTAL:
<01><04><1B><5E><00><04><96><FF>
Seametrics Incorporated • 19026 72nd Avenue South • Kent, Washington 98032 • USA
(P) 253.872.0284 • (F) 253.872.0285 • 1.800.975.8153 • www.seametrics.com
Notes
Seametrics Incorporated • 19026 72nd Avenue South • Kent, Washington 98032 • USA
(P) 253.872.0284 • (F) 253.872.0285 • 1.800.975.8153 • www.seametrics.com
LT-103393-101714
10/17/2014