beautypg.com

Xylem Expert 7060_7070_Modbus User Manual

Page 6

background image

Communication protocol Serie30

Page 12/37

4.8

Function 16: MODBUS Register WRITE

Write a number of subsequent registers on the MODBUS address space starting with StAdd.

Function is implemented in devices Class.Group-Version = 5.20-10.XX and later

A register contains 2 bytes (16 bit).

The number of registers written in one cycle is limited to 2 (0x02) for Class.Group-Version = 5.20-10.XX

Byte-count of the answer will be an even number (1 register = 2 bytes).

Addresses above 0xFF00 are virtual command registers that simply execute a task on the slave. Please refer to chapter

“4.9 MODBUS Register Map” for more information.

Writing float values (0x03XX and 0xFFXX) always requires 2 data registers.

#Reg in the response declares the number of actually written registers (in case an error occurs, this amount is not the

same as in the request)

Request:

DevAddr

0x10

StAdd H StAdd L # Reg H # Reg L # Bytes Data H Data L

Data H Data L CRC16 L CRC16 H

Response:

DevAddr

0x10

StAdd H StAdd L # Reg H # Reg L CRC16_L CRC16_H

Error:

DevAddr

0x90

Error

CRC16_L CRC16_H

Error codes:

2

Illegal data address:

- Undefined starting-address or wrong number of registers

- Start-address not defined (for writing)

3

Illegal data value:

- The amount of data is out of bound

- Byte-Count is not twice the # Reg.

4

Slave Device Failure:

- Attempted to write into a protected register

- The data written is outside the defined data range