[. . . ] 1. 2 MODBUS functions
These functions are available on EM21: · Reading of n "Holding Registers" (code 03h) · Reading of n "Input Register" (code 04h) · Writing of one "Holding Registers" (code 06h) · Diagnostic (code 08h with sub-function code 00h) · Broadcast mode (writing instruction on address 00h) 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". [. . . ] Request frame
Description Physical address Function code Starting address Quantity of registers (N word) CRC Length 1 byte 1 byte 2 bytes 2 bytes 2 bytes Value 1 to F7h (1 to 247) 04h 0000h to FFFFh 1 to 10h (1 to 11) Note
Byte order: MSB, LSB Byte order: MSB, LSB
Response frame (correct action)
Description Physical address Function code Quantity of requested bytes Register value CRC Length 1 byte 1 byte 1 byte N*2 bytes 2 bytes Value 1 to F7h (1 to 247) 04h N word * 2 Byte order: MSB, LSB Note
Response frame (incorrect action)
Description Physical address Function code Exception code CRC Length 1 byte 1 byte 1 byte 2 bytes Value 1 to F7h (1 to 247) 84h 01h, 02h, 03h, 04h Note Possible exception : 01h: illegal function 02h: illegal data address 03h: illegal data value 04h: slave device failure
1. 2. 3 Function 06h (Write Single Holding Register) This function code is used to write a single holding register. The Request frame specifies the address of the register (word) to be written and its content. The correct response is an echo of the request, returned after the register content has been written. Request frame
Description Physical address Function code Starting address Register value CRC Length 1 byte 1 byte 2 bytes 2 bytes 2 bytes Value 1 to F7h (1 to 247) 06h 0000h to FFFFh 0000h to FFFFh Note
Byte order: MSB, LSB Byte order: MSB, LSB
Response frame (correct action)
Description Physical address Function code Starting address Register value CRC Length 1 byte 1 byte 2 bytes 2 bytes 2 bytes Value 1 to F7h (1 to 247) 06h 0000h to FFFFh 0000h to FFFFh Note
Byte order: MSB, LSB Byte order: MSB, LSB
EM24-DIN Communication Protocol
4
Energy management
Response frame (incorrect action)
Description Physical address Function code Exception code CRC Length 1 byte 1 byte 1 byte 2 bytes Value 1 to F7h (1 to 247) 86h 01h, 02h, 03h, 04h Note Possible exception : 01h: illegal function 02h: illegal data address 03h: illegal data value 04h: slave device failure
1. 2. 4 Function 08h (Diagnostic with sub-function code 00h) MODBUS function 08h provides a series of tests to check the communication system between a client (Master) device and a server (Slave), or to check various internal error conditions in a server. With this sub-function the data passed in the request data field is to be returned (looped back) in the response. Request frame
Description Physical address Function code Sub-function Data (N word) CRC Length 1 byte 1 byte 2 bytes N *2 bytes 2 bytes Value 1 to F7h (1 to 247) 08h 0000h Data Note
Byte order: MSB, LSB
Response frame (correct action)
Description Physical address Function code Sub-function Data (N word) CRC Length 1 byte 1 byte 2 bytes N *2 bytes 2 bytes Value 1 to F7 (1 to 247) 08h 0000h Data Note
Byte order: MSB, LSB
Response frame (incorrect action)
Description Physical address Function code Exception code CRC Length 1 byte 1 byte 1 byte 2 bytes Value 1 to F7h (1 to 247) 88h 01h, 02h, 03h, 04h Note Possible exception : 01h: illegal function 02h: illegal data address 03h: illegal data value 04h: slave device failure
1. 2. 5
Broadcast mode
In broadcast mode the master can send a request (command) to all the slaves. It is possible to send the broadcast message only with function code 06h using address 00h.
EM24-DIN Communication Protocol
5
Energy management
1. 3 1. 3. 1
Application notes RS485 general considerations
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). The network termination is necessary even in case of point-to-point connection and/or of short distances. 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. For bus connection it is suggested to use an AWG24 balanced pair cable and to add a third wire for GND connection. If an instrument does not answer within the "max answering time", it is necessary to repeat the query. [. . . ] UNIT Kwh per pulse Data Format UINT 16 Notes Value min = 1 (0, 01Kwh) Value max = 999 (9, 99KWh)
MODBUS: read read and write mode
2. 7. 6
Serial port configuration menu
Table 2. 7-5
VARIABLE ENG. UNIT RS485 instrument address Data Format UINT 16 Notes Value min = 1 Value max = 247
MODBUS: read and write mode
Modicom address 304105 Physical address 1008h Length (words) 1
Note: The number of stop bits is fixed to "1" and the parity control is fixed to "none".
2. 7. 7
Reset commands
Table 2. 7-12
VARIABLE ENG. [. . . ]