12
2.3.2 Function Field
The function field contains the function code that tells the Powermeter what action to perform.
Function codes used in the protocol are shown below in Table 2-2.
Table 2-2 Function Codes Used in PC - Powermeter Protocol
Code
(Decimal)
Meaning in MODBUS Action
20 Read general reference Obtain data from Powermeter
21 Write general reference Transmit data to Powermeter
03 Read holding registers Obtain data from Powermeter
04 Read input registers Obtain data from Powermeter
16 Preset multiple registers Transmit data to Powermeter
06 Preset single register Transmit data to Powermeter
08 Loop back test
Code 0- return query data
Communication test
NOTE Broadcast mode is available only for function codes 06 and 16.
2.3.3 Data Field
The data field contains information needed by the Powermeter to perform a specific function or it
contains data collected by the Powermeter in response to a query.
2.3.4 Error Check Field
The error check field contains the result of Cyclical Redundancy Check (CRC). The start of the
message is ignored in calculating the CRC.
CRC-16 (Cyclic Redundancy Check) Error Check Sequence
The message (data bits only, disregarding start/stop and optional parity bits) is considered one
continuous binary number whose most significant bit (MSB) is transmitted first. The message is
pre-multiplied by x
16
(shifted left 16 bits), then divided by x
16
+ x
15
+ x
2
+ 1 expressed as a
binary number (11000000000000101). The integer quotient digits are ignored and the 16-bit
remainder (initialized to all ones at the start to avoid the case of all zeros being an accepted
message) is appended to the message (MSB first) as the two CRC check bytes. The resulting
message including CRC, when divided by the same polynomial (x
16
+ x
15
+ x
2
+ 1) at the
receiver will give a zero remainder if no errors have occurred. (The receiving unit recalculates the
CRC and compares it to the transmitted CRC). All arithmetic is performed modulo two (no
carries).
The device used to serialize the data for transmission will send the conventional LSB or right-
most bit of each character first. In generating the CRC, the first bit transmitted is defined as the
MSB of the dividend. For convenience then, and since there are no carries used in arithmetic,
let's assume while computing the CRC that the MSB is on the right. To be consistent, the bit order
of the generating polynomial must be reversed. The MSB of the polynomial is dropped since it
affects only the quotient and not the remainder. This yields 1010 0000 0000 0001 (Hex A001).
Note that this reversal of the bit order will have no affect whatever on the interpretation or bit
order of characters external to the CRC calculations.