EM21 Modbus
EM21 Modbus
EM21 Modbus
COMMUNICATION
PROTOCOL
Version 1 Revision 0
1.1 Introduction
The RS485 serial interface supports the MODBUS/JBUS (RTU) protocol. In this document only the
information necessary to read/write from/to EM21 has been reported (not all the parts of the protocol
have been implemented).
For a complete description of the MODBUS protocol please refer to the
“Modbus_Application_Protocol_V1_1a.pdf” document that is downloadable from the www.modbus.org
web site.
IMPORTANT:
1) In this document the “Modbus address” field is indicated in two modes:
1.1) “Modicom address”: it is the “6-digit Modicom” representation with Modbus function code 04
(Read Input Registers). It is possible to read the same values with function code 03 (Read
Holding Registers) replacing the first digit (“3”) with the number “4”.
1.2) “Physical address”: it is the “word address” value to be included in the communication
frame.
2) The functions 03h and 04h have exactly the same effect and can be used indifferently.
3) The communication parameters are to be set according to the configuration of the instrument
(refer to EM21 instruction manual)
Request frame
Description Length Value Note
Physical address 1 byte 1 to F7h (1 to 247)
Function code 1 byte 03h
Starting address 2 bytes 0000h to FFFFh Byte order: MSB, LSB
Quantity of registers (N word) 2 bytes 1 to 10h (1 to 11) Byte order: MSB, LSB
CRC 2 bytes
3
Energy management
Request frame
Description Length Value Note
Physical address 1 byte 1 to F7h (1 to 247)
Function code 1 byte 04h
Starting address 2 bytes 0000h to FFFFh Byte order: MSB, LSB
Quantity of registers (N word) 2 bytes 1 to 10h (1 to 11) Byte order: MSB, LSB
CRC 2 bytes
Request frame
Description Length Value Note
Physical address 1 byte 1 to F7h (1 to 247)
Function code 1 byte 06h
Starting address 2 bytes 0000h to FFFFh Byte order: MSB, LSB
Register value 2 bytes 0000h to FFFFh Byte order: MSB, LSB
CRC 2 bytes
4
Energy management
Request frame
Description Length Value Note
Physical address 1 byte 1 to F7h (1 to 247)
Function code 1 byte 08h
Sub-function 2 bytes 0000h
Data (N word) N *2 bytes Data Byte order: MSB, LSB
CRC 2 bytes
In broadcast mode the master can send a request (command) to all the slaves. No response is returned
to broadcast requests sent by the master. It is possible to send the broadcast message only with
function code 06h using address 00h.
5
Energy management
1. To avoid errors due to the signal reflections or line coupling, it is necessary to terminate the bus at
the beginning and at the end (inserting a 120 ohm 1/2W 5% resistor between line B and A in the last
instrument and in the Host interface).
2. The network termination is necessary even in case of point-to-point connection and/or of short
distances.
3. For connections longer than 1000m or if in the network there are more than 160 instruments (with
1/5 unit load as used in EM21 interface), a signal repeater is necessary.
4. For bus connection it is suggested to use an AWG24 balanced pair cable and to add a third wire for
GND connection. Connect GND to the shield if a shielded cable is used.
5. The GND is to be connected to ground only at the host side.
6. If an instrument does not answer within the “max answering time”, it is necessary to repeat the
query. If the instrument does not answer after 2 or 3 consecutive queries, it is to be considered as
not connected, faulty or reached with a wrong address. The same consideration is valid in case of
CRC errors or incomplete response frames.
6
Energy management
2 TABLES
The variables are represented by integers or floating numbers, with 2’s complement notation in case of
“signed” format, using the following:
Format IEC data type Description Bits Range
INT16 INT Integer 16 -32768 .. 32767
UINT16 UINT Unsigned integer 16 0 .. 65535
INT32 DINT Double integer 32 -231 .. 231
UINT32 UDINT Unsigned double int 32 0 .. 232-1
UINT64 ULINT Unsigned long integer 64 0 .. 264-1
IEEE754 SP Single-precision floating- 32 -(1+[1 –2-23])x2127 .. 2128
point
For all the formats the byte order (inside the single word) is MSB->LSB. In INT32, UINT32 and UINT64
formats, the word order is LSW-> MSW.
The maximum electrical input values are reported in the following table. If the input is above the
maximum value the display shows “----”.
Table 2.1-1
AV5 input option AV6 input option
Max value Min value Max value Min value
VL-N 485V 0 150V 0
VL-L 840V 0 260V 0
A 6,5A 0 6,5A 0
VT 6000 1.0 6000 1.0
CT 60000 1.0 60000 1.0
The overflow indication “----“ is displayed when the MSB value of the relevant variable is 7FFFh.
7
Energy management
8
Energy management
9
Energy management
2.7.8 Note
A default value is not automatically assignes to the parameters when an out-of-range or invalid value is
written.
If an invalid value is assigned to any parameter, the unit could not work properly.
3 REVISIONS
This is the first release of the EM21 communication protocol
10