
ELKOR TECHNOLOGIES INC.
- Page 34 -
MCM
–
USER MANUAL
Response:
Modbus
Address
Function
Code
Starting Address
Register Count
CRC
1-63
16
0-65535
1-123
(CRC)
(1 byte)
(1 byte)
(2 bytes)
(2 bytes)
(2 bytes)
6.8.
Mask Write Register
This command is used to modify bits in an individual register, based on an AND mask and an OR mask. The register is
written to based on the result of the following expression:
Result = (Current Contents AND AndMask) OR (OrMask AND (NOT AndMask))
Example 1:
To clear the 1
st
bit of a register to 0, use an AND mask of 0xFFFE and an OR mask of 0x0000.
Example 2:
To set the 1
st
bit of a register to 1, use an AND mask of 0xFFFE and an OR mask of 0x0001.
Example 3:
To AND the value of a register with 0x5555, use an AND mask of 0x5555 and an OR mask of 0.
The structure of its frames is as follows:
Request:
Modbus
Address
Function
Code
Address
And Mask
Or Mask
CRC
1-63
22
0-65535
Hi-byte
Lo-byte
Hi-byte
Lo-byte
(CRC)
(1 byte)
(1 byte)
(2 bytes)
(2 bytes)
(2 bytes)
(2 bytes)
Response (identical to the request):
Modbus
Address
Function
Code
Address
And Mask
Or Mask
CRC
1-63
22
0-65535
Hi-byte
Lo-byte
Hi-byte
Lo-byte
(CRC)
(1 byte)
(1 byte)
(2 bytes)
(2 bytes)
(2 bytes)
(2 bytes)
6.9.
Read/Write Multiple Registers
This function performs reads and writes in a single command. The writes occur before the reads. The structure of its
frames is as follows:
Request:
Modbus
Address
Function
Code
Read
Starting
Address
Read
Count
Write
Starting
Address
Write Count
Write
Byte
Count
First Value
…
CRC
1-63
23
0-65535
1-125
0-65535
1-121
2-246
Hi-byte
Lo-byte
(CRC)
(1 byte)
(1 byte)
(2 bytes)
(2 bytes)
(2 bytes)
(2 bytes)
(1 byte)
(2 bytes)
(2 bytes)
Response:
Modbus
Address
Function
Code
Byte
Count
First Value
…
CRC
1-63
23
2-250
Hi-byte
Lo-byte
(CRC)
(1 byte)
(1 byte)
(1 byte)
(2 bytes)
(2 bytes)
Note:
The response format for Read/Write Multiple Registers is identical to that of Read Holding Registers,
aside from the function code.