130
•
Fieldbus Communication
MODBUS
Functions
WAGO-I/O-SYSTEM
750
ETHERNET TCP/IP
4.2.3.10 Function Code FC22 (Mask Write Register)
This function manipulates individual bits within a register using a combination
of an AND mask, an OR mask, and the register’s current content.
Request
Byte
Field name
Example
Byte 0, 1
Transaction identifier
0x0000
Byte 2, 3
protocol identifier
0x0000
Byte 4, 5
length field
0x0002
Byte 6
Unit identifier
0x01 not used
Byte 7
MODBUS function code
0x16
Byte 8-9
Reference Number
0x0000
Byte 10-11
AND-Mask
0x0000
Byte 12-13
OR-Mask
0xAAAA
Response
Byte
Field name
Example
.....
Byte 7
MODBUS function code
0x10
Byte 8-9
Reference Number
0x0000
Byte 10-11
AND-Mask
0x0000
Byte 12-13
OR-Mask
0xAAAA
Exception
Byte
Field name
Example
.....
Byte 7
MODBUS function code
0x85
Byte 8
Exception code
0x01 or 0x02