place.
This process is repeated until all eight shifts have been performed. After the last shift, the next
8-bit message byte is exclusive OR'ed with the lower half of the 16 bit register, and the process
repeated. The final contents of the register, after all the bytes of the message have been
applied, is the error check value.
In the following pseudo code “Error Word” is a 16-bit value
representing the error check values.
BEGIN
Error Word = Hex (FFFF)
FOR Each byte in message
Error Word = Error Word XOR byte in message
FOR Each bit in byte
LSB = Error Word AND Hex (0001)
IF LSB = 1 THEN Error Word = Error Word
– 1
Error Word = Error Word / 2
IF LSB = 1 THEN Error Word = Error Word XOR Hex (A001)
NEXT bit in byte
NEXT Byte in message
END
3.6 Function Codes
The function code part of a MODBUS Protocol message defines the action to be taken by the
slave. Eastron Digital meters support the following function codes:
Code
MODBUS Protocol
name
Description
03
Read Holding
Registers
Read the contents of read/write
location(4X references)
04
Read Input Registers
Read the contents of read only
location(3X references)
08
Diagnostics
Only sub-function zero is supported.
This returns the data element of the
query unchanged.
15
Pre-set Multiple
Registers
Set the contents of read/write
location (4X references)
3.7 IEEE floating point format
The MODBUS Protocol defines 16 bit “Registers” for the data variables. A 16-bit number would
prove too restrictive, for energy parameters for example, as the maximum range of a 16-bit
number is 65535.
However, there are a number of approaches that have been adopted to overcome this
restriction. Eastron Digital meters use two consecutive registers to represent a floating-point
number, effectively expanding the range to +/- 1x10
37
.
The values produced by Eastron Digital meters can be used directly without any requirement
to “scale” the values, for example, the units for the voltage parameters are volts, the units for
B+G e-tech GmbH °
DE 01979 Lauchhammer °
www.eastron-germany.de