beautypg.com

3 data types used in the modbus registers, Ata types used in the, Modbus – K-Patents SeedMaster 2 User Manual

Page 85: Registers

background image

11 COMMUNICATION

85

85

(1byte)

11h

03h

80h

128 bytes

CRC

Function code: 16 (write), RTU mode

Write the first 32 data (64 registers, i. e. 128 bytes) into the „write data” table of the 2

nd

Crystallizer of SeedMaster 2 having station address 17 (11h):

Query:

Slave

address

Function

code

1

st

register

address

(high
byte)

1

st

register

address

(low

byte)

No of

registers

(high
byte)

No of

registers

(low

byte)

No of
bytes

(1 byte)

Data bytes

CRC
code

(2

bytes)

11h

10h

00h

180h

00h

40h

80h

128 bytes

CRC


Response:

Slave

address

Function

code

1

st

register

address

(high byte)

1

st

register

address

(low byte)

No of

registers

(high byte)

No of

registers

(low byte)

CRC
code

(2 bytes)

11h

10h

00h

00h

00h

40h

CRC

Remark: Byte order on the MODBUS communication: High byte first, Low byte second.

11.3 Data types used in the MODBUS registers

A single MODBUS register has 2 bytes for data storage.

Byte (8 bit unsigned integer)

Low or high byte of a MODBUS register, value range 0…255 (00h…FFh)

Word (16 bit unsigned integer)

One MODBUS register can be a word type variable, value range 0 .. 65535 (0000h … FFFFh)

Real (FLOAT)

All of the SeedMaster 2 data / variables are 4 byte real type.

The real values have the standard IEEE 754/1985 SHORT REAL (SINGLE PRECISION) 4 byte format and
are stored in two consecutive registers.

The value range is +/-(8.43*10

-37

– 3.4*10

+38

), the resolution is 7 decimals.

Measured and calculated data of SeedMaster 2 are of the 4 byte real, IEEE standard type.
This way a SeedMaster 2 real (float) data can be accessed by reading 2 registers.

Data on the serial line reading a measured value:

First register:

(reg1)

Second register:

(reg2)

High byte (reg1_Hi)

Low byte (reg1_Lo)

High byte (reg2_Hi)

low byte (reg2_Lo)


The received bytes have to be arranged as shown below to form a real number:

MSB

LSB

reg2_Hi

reg2_Lo

reg1_Hi

reg1_Lo


The number format:

reg2_Hi

reg2_Lo

reg1_Hi

reg1_Lo

Exponent (8bit)

Mantissa (23 bit)


S:

Bit31

sign of the number, 0 if the real number is positive.