CHAPTER 2: MODBUS COMMUNICATION MODBUS FUNCTION CODES
D90
PLUS
LINE DISTANCE PROTECTION SYSTEM – COMMUNICATIONS GUIDE 5
1. FFFF (hex) --> A
2. 0 --> i
3. 0 --> j
4. Di (+) Alow --> Alow
5. j + 1 --> j
6. shr (A)
7. Is there a carry?
If No: go to 8;
If Yes: G (+) A --> A and continue
8. Is j = 8?
If No: go to 5;
If Yes: continue
9. i + 1 --> i
10.Is i = N?
If No: go to 3;
If Yes: continue
11. A --> CRC
where
--> is data transfer
A is 16-bit working register
Alow is low order byte of A
Ahigh
is high order byte of A
CRC is 16-bit CRC-16 result
i, j are loop counters
(+) is logical exclusive-OR operator
N is total number of data bytes
Di is the i-th data byte (i = 0 to N–1)
G is 16-bit characteristic polynomial = 1010000000000001 (binary) with MSbit dropped and
bit order reversed
shr (x) is right-shift operator (the LSbit of x is shifted into a carry flag, a "0" is shifted into
the MSbit of x, all other bits are shifted right one location)
Modbus function codes
While the Modbus protocol defines function codes from 1 to 127, only a small subset
generally is needed. The table outlines the functions supported by the D90
Plus
.
Table 2: Modbus function codes supported
Read actual values
The read actual values function codes (04h) allow the master to read one or more
consecutive data registers (actual values) from a D90
Plus
device. Data registers are always
16-bit (two-byte) values transmitted with the high-order byte first. The maximum number
of registers that can be read in a single packet is 125. See the Modbus Memory Map table
for details on the data registers.
Function code Modbus definition GE Grid Solutions definition
Hex Decimal
03 3 Read holding registers Read settings
04 4 Read input registers Read actual values
05 5 Force single coil Execute command