Modbus and ION Technology: Technical Note
Modbus and ION Technology: Technical Note
This technical note describes the Modbus protocol in general, how to use
ION meters and software with Modbus devices, and how ION meters fit into a
Modbus network.
In This Document
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
The Modbus Message . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
Modbus Maps for ION Meters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
Introduction
Modbus is a protocol used in industrial manufacturing. It was created to transfer
control data between controllers and sensors using RS‐232 serial ports. The
Modbus protocol is widely used and supported on serial (RS‐232 and RS‐485) and
Ethernet (TCP/IP) connections.
Modbus is a master/slave protocol where the master initiates transactions and the
slaves respond with the requested data or action. Modbus masters are usually
software programs, such as Distributed Control Systems (DCS). However, masters
can also be devices such as remote terminal units (RTU), programmable logic
controllers (PLC) or ION meters. Modbus slaves are devices such as PLCs,
I/O monitoring devices, relays, software and ION meters.
ION meters, when used as Modbus master or slave devices, provide sensing for
your Modbus network so you can quickly view and respond to power data and
equipment status information.
Modbus Plus
Modbus Plus is a proprietary Modicon protocol used in industrial networking
systems. It uses token‐passing peer‐to‐peer communications at a data transfer rate
of one megabit per second (high‐speed passing of groups of bits within a layer).
The network medium is shielded twisted‐pair cable.
Modbus/TCP
Modbus/TCP defines the packet structure and connection port (port 502) for the
industry standard TCP/IP protocol. The structure of a Modbus/TCP packet is very
similar to the Modbus RTU packet except that it has an extra six‐byte header and
does not require the cyclic redundancy check (CRC). Some ION firmware supports
Modbus/TCP for direct communications with the meter, as well as for use in a
Modbus gateway.
Modbus/TCP retains the Modbus RTU limit of 256 bytes to a packet. It is suggested
that higher throughput is possible if this limitation is removed. This variant is
called Enhanced Modbus/TCP but, so far, few devices have moved to support it.
NOTE
Some devices support multiple simultaneous Modbus/TCP connections. If you are trying to connect to one
of these meters, it can take some time. Adjust your network timeout settings to accommodate this.
1
Unit ID 0 (zero) is also allowed. This sends a broadcast message to all slave meters.
ION meters are preconfigured with a unit ID that you can change from the front
panel of the meter or via software. This unit ID serves as the slave address that the
master uses to determine which slave to communicate with.
The function code used is based on the variable type that a particular ION meter
supports, and whether the ION meter is acting as a master or a slave.
Variable Types
The basic Modbus message building blocks are called variable types. Variable
types group data into address ranges that perform certain functions (using
function codes). For example, Coil registers have an address range from 00001 to
09999 and the data that makes up the message can be read or written to (Function
1, 5 and 15).
There are four main classes of Modbus data, or variable types, that support
different function codes. Coil and input registers are single‐bit registers used to
indicate ON or OFF conditions. Input and holding registers are 16‐bit registers
used to store and retrieve data.
Coils Digital bits that can be read and written to Function 1, 5, 15 00001 to 09999
Input Status Digital bits that can be read Function 2 10001 to 19999
Input Registers 16-bit integers that can be read Function 4 30001 to 39999
Holding Registers 16-bit integers that can be read and written to Function 3, 6 and 16 40001 to 49999
Function Codes
ION meters (acting as master or slave) use ION modules (Modbus Master Device,
Modbus Master Mapping, Modbus Import, Modbus Export and Modbus Slave
modules) to support the following function codes:
ION master or
Function Description ION module that supports the function
slave function
Function 1 Read Coil Status Master Modbus Import, Modbus Master Device, and Modbus Master Map1
Function 2 Read Input Status Master Modbus Import, Modbus Master Device, and Modbus Master Map1
Function 3 Read Holding Registers Master and slave Modbus Import, Modbus Master Device, and Modbus Master Map1
Function 4 Read Input Registers Master Modbus Import, Modbus Master Device, and Modbus Master Map1
Function 16 Write to Multiple Holding Registers Master and slave Modbus Export and Modbus Slave
1
The Modbus Master Map module and the Modbus Master Device module work together, and reference
the settings in Modbus Master Options module; you need all modules configured properly for this
feature to work.
The maximum number of Modbus registers the module can read at once (per
request) depends on the Modbus format and data register type. Modbus supports
a combination of 16‐bit data types. These data formats use one or two 16‐bit words
to encode signed/unsigned or integer/floating point numbers:
1
ION meters acting as Modbus masters support two versions of IEEE Float with different word orders:
high/low = Big Endian, low/high = Little Endian. Big Endian/Little Endian is supported for all 32-bit
formats by ION meters acting as Modbus masters.
When a master sends a request to a fixed map on the ION meter (slave), the value
is written to the corresponding mapped register on the ION meter. For example,
the Modbus master sends “5” to register “44590” which changes the baud rate on
COM2 to 19200—the baud rate is an enumerated parameter and the fifth
enumeration is 19200.
ION meters also provide a flexible map that you can use for reading data. The
flexible Modbus map lets you read various ION registers with Modbus master
devices by correlating the Modbus register number with the address of the ION
register (on the slave) you want to read. When a Modbus master requests to read
a register, the corresponding ION register data is returned.
Vln b
For more information on the Modbus flexible map for ION meters, see the Common
Modbus Registers document and Appendix E of the ION7300 Series Modicon Modbus
Serial Communications Protocol document.
NOTE
If you have Advanced security enabled, you must configure the Modbus Map Access register to allow write
access for specific users. See the Security Options module description in the ION Reference. If you have
Standard or Advanced security enabled on the meter, you can only read Modbus information from a
slave module. You must disable Standard security to write data to a slave module. See the ION System
Security technical note for more information.
You can use ION Setup or ION Enterprise software to collect data from and send
data to Modbus devices directly. Similarly, the ION meter with Modbus master
capability can collect data from a Modbus network and send it to ION Setup or
ION Enterprise software for display and analysis. Using ION Setup or ION
Enterprise software, you can configure these meters to read data from and write
data to Modbus slave devices.
The following section describes different scenarios where ION meters and ION
Setup or ION Enterprise software integrate with Modbus devices and networks.
Ethernet Modbus
Modbus/TCP slave
You can also make a serial connection to an ION meter using third‐party software.
Set the communication port on the meter using the front panel of the meter.
Modbus
RS -4 slaves
85
Setting the serial communication from the ION meter to third-party software
1. Using the front panel of the meter, navigate to the communications port you
want to use to connect to third‐party software.
2. Set the protocol for this port to “Modbus RTU” and ensure the baud rate, unit
ID, serial port and RS‐232 or RS‐485 settings are correct.
Use ION Setup or ION Enterprise software to modify these settings for meters
without a front panel display.
ION Enterprise
software
Modbus/TCP
Use the ION Enterprise Modbus Device Importer utility to configure your Modbus
device (mapping information) and add it as a Device Type to the Network
Configuration database.
NOTE
See the online ION Enterprise Help for more information on adding Modbus device types to
ION Enterprise. You can also contact Technical Support about pre-made Device Integration Packages,
which add a device directly into your system.
Once the device type is added, you can see your Modbus device in a drop‐down
menu in Management Console.
If the ION meter you are using is acting as a master, there are two communication
links to consider when you communicate from a Modbus network (or device) to
ION Setup or ION Enterprise software:
Between the hardware communications port on the ION meter and the
Modbus network. There are two link types, serial or Ethernet. Modbus Master
over Ethernet using TCP/IP is not available on all meter types.
The serial link is a one‐to‐one relationship between the physical
communications port on the meter (COM1, COM2, etc.) and the serial
wiring that connects the meter to a Modbus network (RS‐232 or RS‐485).
NOTE
Most Modbus Master-enabled meters support only one serial bus of Modbus Slave devices. However,
some meters offer multiple Modbus Master serial port functionality. See “Multiport Serial Modbus Master”
on page 15 for more information.
The TCP/IP link can connect up to ten devices to the Modbus Master. The
connections are created by entering the IP address of the device you want to
connect to and the port number (Modbus TCP/IP is port 502).
Between the ION meter and ION Setup or ION Enterprise software — For
Ethernet communications, the meter allows multiple TCP/IP “virtual ports” (i.e
502, 7701, etc.) to connect to a single hardware port. On the meter, TCP/IP virtual
ports indicate to the software which protocol is being used to communicate.
The image below shows how ION Setup or ION Enterprise software and an ION
meter (communicating over Ethernet) can integrate with a serial Modbus network.
ION meter as
Modbus Master
ION Enterprise
software
Modbus 192.168.0.1:502
device data
Ethernet
ION meter as
Ethernet
Modbus Master
Up to 10 unique IP
addresses can be entered
for Modbus Master
The EtherGate meter acts as an intermediary between the RS‐485 devices (Modbus
slaves) and the Modbus master, allowing the Modbus master to send and receive
data over TCP/IP. In ION Enterprise, users can create an EtherGate site and
communicate with a series of devices on the RS‐485 loop.
For more information on EtherGate and ION meters, see The ION Meter as an
Ethernet Gateway technical note.
RS-485 loop
(Modbus RTU)
The Modbus Gateway meter acts as an intermediary between Modbus slaves on a
serial network and the Modbus master device, allowing data to be sent and
received over Modbus/TCP.
For more information on using your ION meter as a Modbus Gateway, see your
meter’s User Guide.
NOTE
Only one meter on a Modbus network can have the communications channel set to the Modbus Master
protocol.
NOTE
There are many Modbus Import, Modbus Export and Modbus Master Device modules available. The
modules behave like Modbus controllers. However, each module can only communicate to a single
Modbus slave device on a single communication connection.
Reading Data from Modbus devices using the Modbus Master Device Module
1. Start Designer (ensure that Options > Show Toolbox is checked).
2. Navigate to the Modbus Master Options module. Right‐click the module to edit
the register values.
For serial Modbus Master, configure the Serial Connection values to match
the communications port (e.g., COM2, COM3) being used to communicate
with the Modbus slave devices.
For Modbus Master over TCP/IP, configure the TCP Connection values to
match the IP address of the slave device and the port
(e.g., 192.168.0.1:502).
3. Navigate to where you want to store your Modbus Master configuration (e.g.,
3rd‐Party Protocols > Modbus). Drag out a new grouping object from the
toolbox, name it appropriately and double‐click on your new grouping object. A
blank workspace displays where you can keep your Modbus Master
configuration.
4. Drag out a new Modbus Master Device module to use with your Modbus slave
device. Right‐click the module and configure the following registers:
Enable Boolean Input Set this register to ON. Set to OFF to make the outputs N/A.
Link this register to set the module to Read If this is unlinked, module operates in Polling Mode
Read Now Pulse Input
Now mode. and will request every second.
Enumerated Select the serial or TCP connection you want These connections are configured in the Modbus
Connection
Setup this module to use. Master Options module.
Enter the name of the Modbus slave device -- The output value is in the format: <label>@<slave
Slave Name String Setup
for example, Submeter1. name>[value]
5. Drag out a new Modbus Master Map module. Right‐click the module and
configure the following registers:
Enter the mapping information for this device. This map (label, address, format and scaling
Device Map String Setup See the module description in the ION information) can be used by multiple Modbus
Reference for details. Master Device modules.
6. Link the output registers to desired modules (such as Data Recorders). The
output values from the Modbus Master Device module are appended with a
label and device name. The Data Recorder module understands these names,
and will populate the ION database using them (e.g. kW@Submeter1).
7. In Vista, update your user diagram by dragging a new object from the Diagram
objects toolbar, and configure it to best display your Modbus slave device data.
Reading Data from Modbus devices using the Modbus Import Module
1. Start Designer (ensure that Options > Show Toolbox is checked).
2. Navigate to the Modbus Master Options module. Right‐click the module to edit
the register values.
For serial Modbus Master configure the Serial Connection values to match
the communications port (e.g., COM2, COM3) being used to communicate
with the slave devices.
For Modbus Master over TCP/IP, configure the TCP Connection values to
match the IP address of the slave device and the port
(e.g., 192.168.0.1:502).
3. Navigate to where you want to store your Modbus Master configuration (e.g.,
3rd‐Party Protocols > Modbus). Drag out a new grouping object from the
toolbox, name it appropriately and double‐click on your new grouping object. A
blank workspace displays where you can keep your master configuration.
4. Drag out a Modbus Import module.
5. Use the ReadNow input of the Modbus Import module if you want to setup a
trigger source that activates a read (i.e. a pulse). If you do not link ReadNow, the
module polls Modbus devices continuously.
6. Right‐click the Modbus Import module to configure register settings.
Configure the following setup registers as needed: Connection/COMM Port (if
applicable), Slave Address, Register Address, Number of Registers read by the
module, Format and scaling requirements. The supported Slave Address range
(Unit ID on ION meters) for a Modbus device is from 1 to 247.
7. Link the output registers to desired modules (such as Data Recorders).
8. In Vista, update your user diagram by dragging a new object from the Diagram
objects toolbar, and configure it to best display your Modbus slave device data.
TIP
Use Designer to determine the ION module/register that you want to write to and then use the Common
Modbus Registers document and Appendix E of the ION7300 Series Modicon Modbus Serial
Communications Protocol document to find the corresponding Modbus register number.
For protocols other than ION, consult the appropriate protocol documentation for your device.
8. In Vista, create and link an object that best displays your configuration.
Connection via: This is the serial connection or Ethernet TCP connections
through which you communicate with the slave device. To view the ports/IP
addresses and Modbus protocol assigned to each connection, click
Connections. The Modbus Master Connections screen appears with tabs
containing connection information.
Slave ID: This is the slave ID, or slave address, that the meter uses to
address packets to the slave device.
5. To perform more advanced configuration, connect to your meter in Advanced
Mode and navigate to the relevant folder. To insert a new module, select Insert
> Module. To edit module settings, double‐click on the module in the right‐hand
pane.
The modules relevant to Modbus Master are: Modbus Master Device module,
Modbus Master Map module, Modbus Master Options module, Modbus
Import module and Modbus Export module. For more information on these
modules, see the ION Reference.
NOTE
The ION7550 RTU does not support multiport Modbus Master. The device cannot master on serial
communication ports COM1 and COM2 at the same time.
Multiport serial Modbus Master functionality requires configuration of a special
module (Modbus Master Options) and additional setup registers in three other
modules (Modbus Import, Modbus Export, and Modbus Master Device).
See the ION Reference for more information on these modules.
Workstation with
Modbus Software
ION meter as
Modbus Master
Ethernet LAN
Modbus Slave devices serial bus on COM2 Modbus Slave devices serial bus on COM1
In order for the Master to know on which serial bus a device resides, the Modbus
Master Options module is used to map (or link) a connection to a meter serial
communication port. All modules for the slave devices (Modbus Import, Export
and Modbus Master Device) are then mapped to one of the connections.
The Modbus Master Options module’s four outputs indicate if each serial
connection is actively being used by another ION module (Modbus Import, Export
and Modbus Master Device).
See the example framework below for implementation details. The ION7650
meter, acting as Modbus Master, is communicating with the ION7330, acting as
Modbus Slave. The ION7330 is wired via RS‐485 to the ION7650 meter’s COM 2
port. The ION7330 meter’s Unit ID is 101.
COM2 is set to
Modbus Master
ION7330
UNIT ID = 101
COM2
Connection Serial Connection 2
Serial Connection 2 COM2
Slave Addr
101
NOTE
A Modbus slave can only respond to requests; it cannot initiate them.
Most ION meters have pre‐configured Modbus Slave modules. These can be
accessed using Designer, inside the ION meter’s “3rd‐Party Protocols” folder. If
these pre‐configured modules do not suit your needs, you can drag out new
Modbus Slave modules or change the configuration of the existing ones.
Communications Port
On some ION meters, when there are no input links, the output registers show the
contents of the fixed Modbus address map as defined by the setup registers of the
Slave Module. The values at the map address are copied to the output registers,
starting at the address specified in the BaseAddr setup register, until each output
register is filled. You must change the Format setup register to “Unsigned 16B
Input Mode.”
You can also edit the setup registers of the Slave module if your Modbus master
device requires data in a format different than the factory configuration or requires
special addressing. Modbus Slave modules have the following setup registers:
Setup Register
Format
Base Address
Scaling
IONInMinScale
IONInMaxScale
ModbusOutMinScale
ModbusOutMaxScale
NOTE
Settings for these registers (and defaults) vary depending on meter model and firmware version. See your
meter’s User Guide.
For more information on using the Modbus Slave module, see the Modbus Slave
module description in the ION Reference.