Read Holding Registers (Code = 0x03) |
The function code 0x03 (Read Holding Registers) allow to read informations, randomly, from 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 readed from 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 readed starting from the first specified address |
Sample UDP Packet Session (Request/Response)
REQUEST (SENT BY CLIENT SYSTEM)
|
|||||
Fields |
Mnemonic |
Description |
Lenght |
Sample Data |
Sent bytes and order |
MBAP |
Transaction Identifier |
2 Bytes |
0x2356 |
23H 56H |
|
Protocol Identifier |
2 Bytes |
0x0000 |
00H 00H |
||
Lenght |
2 Bytes |
0x0006 |
00H 06H |
||
Unit Identifier |
1 Byte |
0x05 |
05H |
||
MODBUS Request
|
FC |
Function Code |
1 Byte |
0x03 |
03H |
|
Start Address |
2 Bytes |
0x0240 |
02H 40H |
|
|
Quantity of Registers |
2 Bytes |
0x0004 |
00H 04H |
RESPONSE (SENT BY SERVER PLC)
|
|||||
Fields |
Mnemonic |
Description |
Lenght |
Sample Data |
Sent bytes and order |
MBAP |
Transaction Identifier |
2 Bytes |
0x2356 |
23H 56H |
|
Protocol Identifier |
2 Bytes |
0x0000 |
00H 00H |
||
Lenght |
2 Bytes |
0x0006 |
00H 06H |
||
Unit Identifier |
1 Byte |
0x05 |
05H |
||
MODBUS Response |
FC |
Function Code |
1 Byte |
0x03 |
03H |
|
Content of register 0x0240 |
2 Bytes |
0x1234 |
12H 34H |
|
|
Content of register 0x0241 |
2 Bytes |
0x5678 |
56H 78H |
|
|
Content of register 0x0242 |
2 Bytes |
0x9ABC |
9AH BCH |
|
Content of register 0x0243 |
2 Bytes |
0xDEF0 |
DEH F0H |
Note: Readed data is sent using Big Endian notation (MSB byte first)