Floating point (r23_32) data format, Crc error check – Basler Electric DECS-400 User Manual

Page 223

Advertising
background image

9369700990 Rev R

211

Floating Point (R23_32) Data Format

The specific floating point format matches the floating point format used for the Modicon 984-8 family of
programmable controllers.

Its representation in bit format is:

S EEE EEEE

E MMM
MMMM

MMMM MMMM

MMMM MMMM

byte 3

byte 2

byte 1

byte 0

where the “S” is the sign bit for the floating point value (1) if negative, (0) if positive; the “E” field is the
two’s complement exponent biased by 127 decimal; the “M” field is the 23-bit normalized mantissa. The
most-significant bit of the mantissa is always assumed to be 1 and is not explicitly stored, yielding an
effective precision of 24 bits.

The value of the floating-point number is obtained by multiplying the binary mantissa times two raised to
the power of the unbiased exponent. The assumed bit of the binary mantissa has the value of 1.0, with
the remaining 23 bits providing a fractional value.

Table 32 shows the floating point format.

Table 32. Floating Point Format

Sign

2's Complement Of (Exponent + 127)

Mantissa

1 Bit

8 Bits

23 Bits

The floating point format allows a maximum value of 3.38

× 10

38

.

Note that bytes 0 and 1 of the floating point value are stored in the lower numbered register, and bytes 2
and 3 are contained in the higher numbered register.

For example, number 123 in floating point format is mapped to two holding registers (such as 45005 and
45006) as shown in Table 33.

Table 33. Number 123 in Floating Point Format

Register

45005

45006

Hexadecimal

0000

42F6

Binary

0000 0000 0000 0000

0100 0010 1111 0110

Caution

For DECS-400 Modbus, two consecutive holding registers that are
mapped to any of the four-byte, generic data types, are considered to
be linked together as an atomic, indivisible unit of information that can
be read or written by a Modbus message only as one entity. (That is,
one cannot be read or written without the other.).

CRC Error Check

This field contains a two-byte CRC value for transmission error detection. The master first calculates the
CRC and appends it to the query message. The DECS-400 recalculates the CRC value for the received
query and performs a comparison to the query CRC value to determine if a transmission error has
occurred. If so, no response message is generated. If no transmission error has occurred, the slave
calculates a new CRC value for the response message and appends it to the message for transmission.

The CRC calculation is performed using all bytes of the device address, function code and data block
fields. A 16-bit CRC register is initialized to all 1’s. Then, each eight-bit byte of the message is used in the
following algorithm.

First, exclusive-OR the message byte with the low-order byte of the CRC register. The result, stored in
the CRC register, will then be right-shifted eight times. The CRC register MSB is zero filled with each
shift. After each shift, the CRC register LSB is examined. If the LSB is a 1, the CRC register is then

DECS-400

Modbus™ Communication

Advertising