4 - 19 4 - 19
MELSEC-Q
4 MODBUS
R
STANDARD FUNCTIONS
4.3.11 Mask write register (FC: 22)
Masks the value stored in one holding register with AND or OR, and writes the masked
value.
Number of accessible devices with one message
1 point
The masked value is written to the holding register as described below.
(Target register’s current value AND mask value) (OR mask value AND mask value)
= write value
When the OR mask value is 0000
H
, only the AND processing of the AND mask value
is performed.
When the AND mask value is 0000
H
, the OR mask value becomes the write value.
(1) Request message format (Master Slave)
Target holding register number
(0000
H
to FFFF
H
)
Data
(H)
(L)
(H)
(L)
Function code
Function code
(16
H
)
(H)
(L)
AND mask value
(0000
H
to FFFF
H
)
OR mask value
(0000
H
to FFFF
H
)
(2) Response message format (Slave Master)
(When completed normally)
The slave returns the request message received from the master as it is.
(When completed with an error)
Data
Exception
code*
Function code
Function code
(96
H
)
: When completed with an error, the exception code and error code are stored
into the buffer memory.
Refer to Section 11.3 for the storage location, confirmation method and more
details.
POINT
This function code reads the value stored in the holding register from the slave, and
after AND/OR processing in the master, writes the masked value to the holding
register of the slave.
Therefore, when the holding register value is changed during AND/OR processing,
the new value is overwritten.