Modbus
Modbus
Instruction Manual
s800v005, s801v004 and higher
Notice
© 2006 WALCHEM Corporation
Five Boynton Road, Holliston, MA 01746 USA
(508) 429-1110
All Rights Reserved
Printed in USA
Proprietary Material
The information and descriptions contained herein are the property of
WALCHEM Corporation. Such information and descriptions may not be
copied or reproduced by any means, or disseminated or distributed
without the express prior written permission of WALCHEM Corporation,
Five Boynton Road, Holliston, MA 01746.
180277 Rev C
June 2006
TABLE OF CONTENTS
1.0 SCOPE 1
1.1 VERSIONS ......................................................................................................... 1
2.0 INTRODUCTION 1
3.0 OVERVIEW 1
1.1 VERSIONS
Date Version Author Changes
1/8/04 0.3 Ron Gross Functional Spec
1/19/04 A Nate Martin Based on Functional Spec.
2/17/06 B Charles Johnson Clarification and Commentary
6/20/06 C Charles Johnson Modified Register Map to support
new controller software
2.0 INTRODUCTION
The Webmaster product supports TCP/IP communications on 3 different network
interfaces (USB, modem, and Ethernet). All configurations of set points are accomplished
with a computer running a browser (such as Microsoft Internet Explorer) connected to the
WebMaster over one of these interfaces.
The Modbus/TCP option allows the WebMaster to communicate with PC-based
applications such as WonderWare and Intellution HMI/SCADA programs, Building
Energy Management systems, Distributed Control Systems (DCS), as well as stand-alone
HMI devices. The Modbus/TCP information is only available over the Ethernet interface.
The WebMaster is a Modbus Server, meaning that it is only capable of responding to
requests from the HMI device. The WebMaster cannot initiate the flow of information,
for example, it will not immediately send a new alarm message. It will wait until the HMI
device requests the current data contained in specific register locations.
In addition, the HMI software cannot be used to change set points. This is only possible
using browser software.
If the HMI device does not directly support Modbus/TCP protocol, then a protocol
translation gateway may be required to convert from Modbus/TCP to a protocol that the
device supports. Note that Modbus/RTU requires a serial interface, not Ethernet, and
therefore is not directly compatible with the WebMaster.
3.0 OVERVIEW
Modbus/TCP is a form of Modbus that uses the TCP/IP layers as a base layer for
controlling the communications between different devices.
1
The Modbus/TCP protocol supports multiple types of data transactions, from reading
single bits per transaction, to advanced object-oriented operations. However, to ensure
the most compatible system available, the simplest function set is to be made available.
The Modbus/TCP has each transaction type classified in to conformance classes, to
ensure consistency and interoperability. Class 0 is the simplest, and allows for reading
and writing of multiple 16-bit registers. The Modbus/TCP feature of the WebMaster will
support reading of these 16-bit registers, which allows the WebMaster to establish a
block of data which contains all the process variables, set points, alarms and input/output
statuses that are to be made public to a Modbus/TCP client. This block of data is
packaged so that it can be read in 16-bit chunks (or registers) at a time, regardless of the
type of data within it. In the following sections, the formatting, storing, and reading of
this data are described.
4.1.1 TCP
The Modbus/TCP extension includes 7 additional bytes to the original Modbus protocol,
which allows for transport over the TCP/IP layers.
The Unit Identifier has a special consideration in the WebMaster implementation. If the
value is 0, then the request is considered to be a broadcast message; therefore the packet
2
will be processed, and no response will be generated. If the value is anything else, the
packet will be processed and a response will be generated.
The broadcast Unit Identifier address is not supported as of this release, as the only
function code supported is Read Holding Registers; therefore, a response is required at all
times.
The Modbus/TCP feature only supports Function Code 3 (FC3), Read Multiple Registers,
which allows the reading of up to 125 16-bit registers, or quantities, within a single
request/response cycle. The 125-register limitation is established for the Modbus/TCP
standard to maintain consistency with the original Modbus protocol standard, even
though a TCP/IP packet can support more data.
Request
Function Code 1 byte 0x03
Starting Address 2 bytes 0x0000 to 0xFFFF
Quantity of Registers 2 bytes 1 to 125 (0x01 to 0x7D)
Response
Function Code 1 byte 0x03
Byte Count 1 byte 2 x N*
Register Values N* x 2 bytes
*N = quantity of registers
Error
Function Code 1 byte 0x83
Exception Code 1 byte
Any other Function Code request will be returned with an error response indicating the
Function Code is not supported, as well as a request for too much data or data at a
register address that is not present.
3
close(). Up to 10 connections/sockets are possible at one time. If there are 10 active
connections, any attempt at any more connections is ignored.
Once a connection has been established, it will be closed after 1 minute of inactivity.
There is no requirement for how the tables are implemented within the product, but the
tables are distinctive because of the method that is used to access them within the
protocol.
Since only FC3 is supported in the WebMaster implementation, only the Holding
Registers-type table is required. To access each entry in to the Holding Register table, a
starting address (0 indicates the first entry in the table) is required as well as the number
of registers that are requested.
The data storage does not need to be consecutive; in fact, this implementation uses
multiple ‘blocks’ within the Holding Register table to support future enhancements
and additions to the data without changing the location of the data already present.
The Holding Register table is a large structure that contains smaller structures, each
containing the specific types of data, and associated with a defined starting address offset
for each type of data. The offset allows the driver to determine if the request needs to
access data from the specific structure.
The data within the WebMaster system that is to be made public (process variables, set
points, alarms and input/output status) is divided in to four structures (header, alarms,
status data, and dynamic data). Any time new data needs to be added to the table
(upgraded product, different version, etc), the new data is added to the end of the
particular structure that corresponds with that type of data.
The data is stored within the tables local to the Modbus/TCP driver, which allows the
driver to quickly access it during a request. The tables are indexed in to during a request
using the starting address of the request and the defined offset for that structure.
For example, if the structure containing the headers has an defined offset of 0, and is 128
bytes long and a request for starting address 10 with a length of 5 words is received, the
20th through 29th byte within the table are sent to the client.
4
Once the data is stored within the local tables, the driver does not differentiate what is
stored in them. The Modbus/TCP client needs to know what data is stored in which
register locations to be able to retrieve it, process it, and/or display it.
4.5.1 Binary
A binary item is represented as a single bit within a data word. All binary data is packed
in to 16-bit data words, which are accessed using FC3 therefore, a single register contains
16 bits of binary data, each having a specific meaning.
A 16-bit word item is transmitted with the MOST significant byte first. FC3 reads 16-bit
items at a time; therefore, each of these data items will fit within one register that is read.
5
4.5.3 32-Bit Word (int)
A 32-bit word item is transmitted with the MOST significant byte first, then the next
MOST significant, until all bytes are transmitted. FC3 reads 16-bit items at a time;
therefore, two registers are required to read each 32-bit data item.
A float is 32-bits within the WebMaster product; therefore is transmitted just as a 32-bit
word item is. FC3 reads 16-bit items at a time; therefore, two registers are required to
read each float data item.
4.5.5 Strings
A string is a group of 8-bit data items having a fixed length. The first character of a
string is transmitted first, followed by the remaining characters. FC3 reads 16-bit items
at a time; therefore, a single register contains two characters of the string. To simply
string storage/transfer, each string should be of an even-byte length.
6
4.6 DATA DICTIONARY
The following tables detail the Modbus addresses required to access each item of the
public data.
The addressing within the Modbus/TCP protocol (that is, the data within the physical
packet) is 0-based, meaning the first element/item to be accessed is referenced by address
0. The Modbus standard for handling and displaying the data is 1-based, meaning the
first element/data item to be access is referenced by address 1.
Most client applications handle this by having the user enter the 1-based number, and
then subtract 1 to revert to the 0-based addressing required at the protocol level.
Some client applications allow the user to enter the 0-based number, or a combination,
depending on how it is configured.
The addresses defined within the following table are 1-based, as the majority of the client
applications work with this method.
Header data consists of strings that are available to describe miscellaneous parts of the
product. Refer to section 4.5.5 Strings for the method to extract the string data.
For example, to read the Date item, a Read Holding Register request is generated with
address 40033 and a register quantity of 12.
Alarm states are bit-based, with up to 16 alarms encoded within each register. To access
an individual alarm state, the register is read (using the address value before the ‘:’), and
the specific bit of the register is checked, with the following rules. Refer to section 4.5.2
16-Bit Word (short) for the method to properly extract the data.
1001:1:1 defines a single bit, with ‘:1’ indicating the least significant bit of
the word and ‘:16’ defining the most significant bit of the word
7
1005:9-4 defines multiple bits, with :9-4 defining bits 4 through 9 of the
word
NOTE: ‘* unused bits *’ place holders are provided to allow for future
expansion
For example, to check the Modem Failure Alarm, a Read Holding Register is generated
with address 41001 and a register quantity of 1. When the data is returned, and is
extracted, it is bit-or’ed with 2 to determine the state.
Hardware Register # Bit # Bit Count
Alarm Data Item
Channel
Modem Failure 1001 2 1
Ethernet Failure 1001 3 1
Analog Input Board Failure 1001 4 1
Digital Input Board Failure 1001 5 1
Non-Responding Slave 1001 6 1
4-20mA Output Board Failure 1 1001 7 1
4-20mA Output Board Failure 2 1001 8 1
4-20mA Output Board Failure 3 1001 9 1
4-20mA Output Board Failure 4 1001 10 1
Sensor: BoardFailure 1 1002 1 1
Sensor: SensorError 1 1002 2 1
Sensor: Low Alarm 1 1002 3 1
Sensor: High Alarm 1 1002 4 1
Sensor: Calibration Time 1 1002 5 1
Temperature: Error 1 1002 6 1
Temperature: Low Alarm 1 1002 7 1
Temperature: High Alarm 1 1002 8 1
Sensor: BoardFailure 2 1002 9 1
Sensor: SensorError 2 1002 10 1
Sensor: Low Alarm 2 1002 11 1
Sensor: High Alarm 2 1002 12 1
Sensor: Calibration Time 2 1002 13 1
Temperature: Error 2 1002 14 1
Temperature: Low Alarm 2 1002 15 1
Temperature: High Alarm 2 1002 16 1
Sensor: BoardFailure 3 1003 1 1
Sensor: SensorError 3 1003 2 1
8
Sensor: Low Alarm 3 1003 3 1
Sensor: High Alarm 3 1003 4 1
Sensor: Calibration Time 3 1003 5 1
Temperature: Error 3 1003 6 1
Temperature: Low Alarm 3 1003 7 1
Temperature: High Alarm 3 1003 8 1
Sensor: BoardFailure 4 1003 9 1
Sensor: SensorError 4 1003 10 1
Sensor: Low Alarm 4 1003 11 1
Sensor: High Alarm 4 1003 12 1
Sensor: Calibration Time 4 1003 13 1
Temperature: Error 4 1003 14 1
Temperature: Low Alarm 4 1003 15 1
Temperature: High Alarm 4 1003 16 1
9
Analog Generic: Low Alarm 2 1008 9 1
Analog Generic: High Alarm 2 1008 10 1
Analog Generic: Sensor Error 2 1008 11 1
Analog Generic: Low Alarm 3 1009 1 1
Analog Generic: High Alarm 3 1009 2 1
Analog Generic: Sensor Error 3 1009 3 1
Analog Generic: Low Alarm 4 1009 9 1
Analog Generic: High Alarm 4 1009 10 1
Analog Generic: Sensor Error 4 1009 11 1
Analog Generic: Low Alarm 5 1010 1 1
Analog Generic: High Alarm 5 1010 2 1
Analog Generic: Sensor Error 5 1010 3 1
Analog Generic: Low Alarm 6 1010 9 1
Analog Generic: High Alarm 6 1010 10 1
Analog Generic: Sensor Error 6 1010 11 1
Analog Generic: Low Alarm 7 1011 1 1
Analog Generic: High Alarm 7 1011 2 1
Analog Generic: Sensor Error 7 1011 3 1
Analog Generic: Low Alarm 8 1011 9 1
Analog Generic: High Alarm 8 1011 10 1
Analog Generic: Sensor Error 8 1011 11 1
10
Analog Flow Meter: High Alarm 4 1013 10 1
Analog Flow Meter: Low Alarm 4 1013 11 1
Analog Flow Meter: Total Alarm 4 1013 12 1
Analog Flow Meter: Sensor Error 5 1014 1 1
Analog Flow Meter: High Alarm 5 1014 2 1
Analog Flow Meter: Low Alarm 5 1014 3 1
Analog Flow Meter: Total Alarm 5 1014 4 1
Analog Flow Meter: Sensor Error 6 1014 9 1
Analog Flow Meter: High Alarm 6 1014 10 1
Analog Flow Meter: Low Alarm 6 1014 11 1
Analog Flow Meter: Total Alarm 6 1014 12 1
Analog Flow Meter: Sensor Error 7 1015 1 1
Analog Flow Meter: High Alarm 7 1015 2 1
Analog Flow Meter: Low Alarm 7 1015 3 1
Analog Flow Meter: Total Alarm 7 1015 4 1
Analog Flow Meter: Sensor Error 8 1015 9 1
Analog Flow Meter: High Alarm 8 1015 10 1
Analog Flow Meter: Low Alarm 8 1015 11 1
Analog Flow Meter: Total Alarm 8 1015 12 1
11
Digital Generic Counter: Rate High Alarm 6 1018 6 1
Digital Generic Counter: Rate High Alarm 7 1018 7 1
Digital Generic Counter: Rate High Alarm 8 1018 8 1
Digital Generic Counter: Rate High Alarm 9 1019 1 1
12
Digital Flow Meter: High Alarm 1 1026 9 1
Digital Flow Meter: Low Alarm 1 1026 10 1
Digital Flow Meter: Total Alarm 1 1026 11 1
Digital Flow Meter: High Alarm 2 1027 1 1
Digital Flow Meter: Low Alarm 2 1027 2 1
Digital Flow Meter: Total Alarm 2 1027 3 1
Digital Flow Meter: High Alarm 3 1027 9 1
Digital Flow Meter: Low Alarm 3 1027 10 1
Digital Flow Meter: Total Alarm 3 1027 11 1
Digital Flow Meter: High Alarm 4 1028 1 1
Digital Flow Meter: Low Alarm 4 1028 2 1
Digital Flow Meter: Total Alarm 4 1028 3 1
Digital Flow Meter: High Alarm 5 1028 9 1
Digital Flow Meter: Low Alarm 5 1028 10 1
Digital Flow Meter: Total Alarm 5 1028 11 1
Digital Flow Meter: High Alarm 6 1029 1 1
Digital Flow Meter: Low Alarm 6 1029 2 1
Digital Flow Meter: Total Alarm 6 1029 3 1
Digital Flow Meter: High Alarm 7 1029 9 1
Digital Flow Meter: Low Alarm 7 1029 10 1
Digital Flow Meter: Total Alarm 7 1029 11 1
Digital Flow Meter: High Alarm 8 1030 1 1
Digital Flow Meter: Low Alarm 8 1030 2 1
Digital Flow Meter: Total Alarm 8 1030 3 1
Digital Flow Meter: High Alarm 9 1030 9 1
Digital Flow Meter: Low Alarm 9 1030 10 1
Digital Flow Meter: Total Alarm 9 1030 11 1
13
Digital PosiFlow: Failure 8 1031 8 1
Digital PosiFlow: Failure 9 1031 9 1
14
Biocide Skipped Alarm[6] 6 1035 6 1
Biocide Skipped Alarm[7] 7 1035 7 1
Biocide Skipped Alarm[8] 8 1035 8 1
Status data generally consists of 16-bit words, 32-bit longs or floats. To access an
individual Status Data item, 1 or 2 registers are required to be read. Refer to sections
4.5.2 16-Bit Word (short), 4.5.3 32-Bit Word (int) and 4.5.4 Float Inverse for the
methods to properly extract the data. The following rules indicate the format of the table:
Address defines the starting address to read to access the first
element (or only element) of the item
Register Count (Item) defines the number of registers to read to access a
single element of the item
Register Count (Total) defines the number of registers to read to access all
elements of the item
Item Count defines the number of elements within the full item
Item [6-1] defines the item is an array of elements, with item [1]
being accessed first (first set of registers).
15
For example, to check the Analog Input [2] Status, a Read Holding Register is generated
with address 42036 and a register quantity of 1.
Status Data Item Address Register Data Type
Count
(Item)
Sensor [1] Status 2002 1 Integer
Sensor [2] Status 2004 1 Integer
Sensor [3] Status 2006 1 Integer
Sensor [4] Status 2008 1 Integer
16
Relay Output [6] Control Mode 2124 1 Integer
Relay Output [7] Control Mode 2126 1 Integer
Relay Output [8] Control Mode 2128 1 Integer
17
5 Hand 35 Relay 6 Lockout
6 Manual Off 36 Relay 7 Lockout
7 Failure 37 Relay 8 Lockout
8 Invalid 38 No Sensor Selected
9 Calibrate 39 Waiting
10 Calibrate Sen 1 40 Sampling
11 Calibrate Sen 2 41 Holding
12 Calibrate Sen 3 42 Blowdown
13 Calibrate Sen 4 43 No Posi-Flow Configured
14 Normal 44 Units Mismatch
15 Overrange 45 Disp. Lockout
16 Underrange 46 Bio Lockout
17 Loop Cal 47 PreBleed Lockout
18 Sensor Error 48 Pre-Bleed
19 Internal Lock 49 Waiting
20 Unknown 50 On Delay
21 DI A Lockout 51 Pending
22 DI B Lockout 52 Bleed Lockout Time
23 DI C Lockout 53 Bio Add
24 DI 1 Lockout 54 Dispersant Add
25 DI 2 Lockout
26 DI 3 Lockout
27 DI 4 Lockout
28 DI 5 Lockout
29 DI 6 Lockout
18
4.6.5 Dynamic Data
Dynamic data generally consists of 16-bit words, 32-bit longs or floats. To access an
individual Dynamic Data item, 1 or 2 registers are required to be read. Refer to sections
4.5.2 16-Bit Word (short), 4.5.3 32-Bit Word (int) and 4.5.4 Float Inverse for the
methods to properly extract the data. The following rules indicate the format of the table:
Address defines the starting address to read to access the first
element (or only element) of the item
Register Count (Item) defines the number of registers to read to access a
single element of the item
Register Count (Total) defines the number of registers to read to access all
elements of the item
Item Count defines the number of elements within the full item
Item [6-1] defines the item is an array of elements, with item [1]
being accessed first (first set of registers).
For example, to check the item Sensor [1] Current Reading, a Read Holding Register is
generated with address 43001 and a register quantity of 2.
Dynamic Data Item Address Register Data Type
Count
(Item)
Sensor [1] Current Reading 3001 2 Float Inverse
Sensor [1] Uncalibrated Reading 3017 2 Float Inverse
Sensor [1] mV Output 3033 2 Float Inverse
Sensor [1] Temperature Reading 3049 2 Float Inverse
Sensor [1] Uncalibrated Temperature 3065 2 Float Inverse
Sensor [1] Temperature mV 3081 2 Float Inverse
19
Sensor [4] Temperature Reading 3055 2 Float Inverse
Sensor [4] Uncalibrated Temperature 3071 2 Float Inverse
Sensor [4] Temperature mV 3087 2 Float Inverse
20
Dynamic Data Item Address Bit Register Data Type
Register Number Count
(Item)
Digital Input [A] State 3321 9 1 bit Binary
Digital Input [A] Measured Value 3329 2 Float Inverse
Digital Input [A] Total 3361 2 Float Inverse
Digital Input [B] State 3321 1 1 bit Binary
Digital Input [B] Measured Value 3331 2 Float Inverse
Digital Input [B] Total 3363 2 Float Inverse
Digital Input [C] State 3322 9 1 bit Binary
Digital Input [C] Measured Value 3333 2 Float Inverse
Digital Input [C] Total 3365 2 Float Inverse
Digital Input [1] State 3322 1 1 bit Binary
Digital Input [1] Measured Value 3335 2 Float Inverse
Digital Input [1] Total 3367 2 Float Inverse
Digital Input [2] State 3323 9 1 bit Binary
Digital Input [2] Measured Value 3337 2 Float Inverse
Digital Input [2] Total 3369 2 Float Inverse
Digital Input [3] State 3323 1 1 bit Binary
Digital Input [3] Measured Value 3339 2 Float Inverse
Digital Input [3] Total 3371 2 Float Inverse
Digital Input [4] State 3324 9 1 bit Binary
Digital Input [4] Measured Value 3341 2 Float Inverse
Digital Input [4] Total 3373 2 Float Inverse
Digital Input [5] State 3324 1 1 bit Binary
Digital Input [5] Measured Value 3343 2 Float Inverse
Digital Input [5] Total 3375 2 Float Inverse
Digital Input [6] State 3325 9 1 bit Binary
Digital Input [6] Measured Value 3345 2 Float Inverse
Digital Input [6] Total 3377 2 Float Inverse
NOTE: State only applies to
Interlock, Level Switch or
Generic Input Types.
0 = Open, 256 = Closed
21
NOTE: Measured Value only
applies to Generic Counter,
Paddlewheel Flow Meter and
PosiFlow type inputs
NOTE: Total does not apply to
Interlock, Level Switch or
Generic Input types
Relay [1] Interlocking Another 3739 9 1 bit Binary
Relay [2] Interlocking Another 3739 10 1 bit Binary
Relay [3] Interlocking Another 3739 11 1 bit Binary
Relay [4] Interlocking Another 3739 12 1 bit Binary
Relay [5] Interlocking Another 3739 13 1 bit Binary
Relay [6] Interlocking Another 3739 14 1 bit Binary
Relay [7] Interlocking Another 3739 15 1 bit Binary
Relay [8] Interlocking Another 3739 16 1 bit Binary
1 = Interlocking, 2 = Not
Interlocking
Relay [1] Accumulated Makeup 3741 2 Float Inverse
Relay [2] Accumulated Makeup 3743 2 Float Inverse
Relay [3] Accumulated Makeup 3745 2 Float Inverse
Relay [4] Accumulated Makeup 3747 2 Float Inverse
Relay [5] Accumulated Makeup 3749 2 Float Inverse
Relay [6] Accumulated Makeup 3751 2 Float Inverse
Relay [7] Accumulated Makeup 3753 2 Float Inverse
Relay [8] Accumulated Makeup 3755 2 Float Inverse
Not Applicable to all relay control
modes
Relay [1] Accumulated Bleed 3765 2 Float Inverse
Relay [2] Accumulated Bleed 3767 2 Float Inverse
Relay [3] Accumulated Bleed 3769 2 Float Inverse
Relay [4] Accumulated Bleed 3771 2 Float Inverse
Relay [5] Accumulated Bleed 3773 2 Float Inverse
Relay [6] Accumulated Bleed 3775 2 Float Inverse
Relay [7] Accumulated Bleed 3777 2 Float Inverse
Relay [8] Accumulated Bleed 3779 2 Float Inverse
22
Not Applicable to all relay control
modes
Relay [1] Current Week 3790 1 Integer
Relay [2] Current Week 3792 1 Integer
Relay [3] Current Week 3794 1 Integer
Relay [4] Current Week 3796 1 Integer
Relay [5] Current Week 3798 1 Integer
Relay [6] Current Week 3800 1 Integer
Relay [7] Current Week 3802 1 Integer
Relay [8] Current Week 3804 1 Integer
Not Applicable to all relay control
modes
Relay [1] Current Set Point 3814 1 Integer
Relay [2] Current Set Point 3816 1 Integer
Relay [3] Current Set Point 3818 1 Integer
Relay [4] Current Set Point 3820 1 Integer
Relay [5] Current Set Point 3822 1 Integer
Relay [6] Current Set Point 3824 1 Integer
Relay [7] Current Set Point 3826 1 Integer
Relay [8] Current Set Point 3828 1 Integer
Applies to ORP Spike Mode Only
1 = Normal Set Pt, 2 = Spike Set
Point
Relay [1] Cycles Measured 3837 2 Float Inverse
Relay [2] Cycles Measured 3839 2 Float Inverse
Relay [3] Cycles Measured 3841 2 Float Inverse
Relay [4] Cycles Measured 3843 2 Float Inverse
Relay [5] Cycles Measured 3845 2 Float Inverse
Relay [6] Cycles Measured 3847 2 Float Inverse
Relay [7] Cycles Measured 3849 2 Float Inverse
Relay [8] Cycles Measured 3851 2 Float Inverse
Not Applicable to all relay control
modes
23