Write Mutiple Registers (Code = 0x10) |
The function code 0x10 (Write Multiple Registers) allow to write informations, randomly, into the main PLC table
The PLC module acts like SERVER and the request should be prepared by a host system working as CLIENT. The PLC table is 16-bits word aligned array of general purpose data registers. The register address is in the range from zero to the maximum number of registers of your PLC (See specific technical data). For example, if my PLC has 1000 words, my address range is from 0 to 999
The fields related with the request are listed here
Field |
Lenght |
Description |
Start Address |
2 Bytes |
This field keeps the "first location address" that will be written to the PLC table. The field represent a 16bits-aligned entity and can span from 0 to the maximum table size |
Quantity of Registers |
2 Bytes |
This is number of registers that will be written starting from the first specified address |
Data |
(Quantity of Registers) * 2 Bytes |
Data to be written. 16bits aligned entity |
Sample RS232/RS485 Packet Session (Request/Response)
Writing 4 registers starting from address 0x240
REQUEST (SENT BY CLIENT SYSTEM)
|
|||||
Fields |
Mnemonic |
Description |
Lenght |
Sample Data |
Sent bytes and order |
MODBUS Request
|
FC |
Function Code |
1 Byte |
0x10 |
10H |
|
Start Address |
2 Bytes |
0x0240 |
02H 40H |
|
|
Quantity of Registers |
2 Bytes |
0x0004 |
00H 04H |
|
|
Data#0 |
2 Bytes |
0x1234 |
12H 34H |
|
|
Data#1 |
2 Bytes |
0x5678 |
56H 78H |
|
|
Data#2 |
2 Bytes |
0x9ABC |
9AH BCH |
|
|
Data#3 |
2 Bytes |
0xDEF0 |
DEH F0H |
|
CRC |
CRC |
2 Bytes |
0xABCD |
ABH CDH |
RESPONSE (SENT BY SERVER PLC)
|
|||||
Fields |
Mnemonic |
Description |
Lenght |
Sample Data |
Sent bytes and order |
MODBUS Response |
FC |
Function Code |
1 Byte |
0x10 |
10H |
|
Start Address |
2 Bytes |
0x0240 |
02H 40H |
|
|
Quantity of Registers |
2 Bytes |
0x0004 |
00H 04H |
|
CRC |
CRC |
2 Bytes |
0xABCD |
ABH CDH |
Note: Data to write is sent using Big Endian notation (MSB byte first)