MODBUS

<< Click to Display Table of Contents >>

Navigation:  Hardware Overview > Sensors and Probes > HCD-Sx >

MODBUS

The probe can be addressed directly using the MODBUS protocol, to request the measured humidity and temperature values. The parameters highlighted in yellow should be selected according to the table below.

 

Important:

In order to communicate directly with the digital probe via MODBUS, please use the E2-05XX-MOD cable. The digital MODBUS protocol is delivered over RS485.

 

 

Command: (MSB first)

Probe address

Command ID


Start address


Number of records

MODBUS CRC

0x00

0x04

0x00

0x00

0x00

0x00

0x0000

 

 

Probe address

0…255, if '0' then all probes respond regardless of the address.The default probe address is 247.

 

Register

Name

Description

Data type

30’001

Serial Number

Serial number of the device (part 1)

Int. 32 Bit

30’002

Serial number of the device (part 2)

 

Current Values

Current values in 32-bit IEEE754 float format.

Note!

These values are changing every measurement cycle, so always read the two corresponding registers in one Modbus command.

 

Register

Name

Description

Data type

31’001

Humidity

Current humidity value (part 1)

Float 32 Bit

31’002

Current humidity value (part 2)

31’003

Temperature

Current temperature value (part 1)

Float 32 Bit

31’004

Current temperature value (part 2)

31’005

Calculation

Current calculation value (part 1)

Float 32 Bit

31’006

Current calculation value (part 2)

31’007

Measurement flags Humidity

Current measurement flags humidity

Int. 16bit

31’008

Measurement flags Temperature

Current measurement flags temperature

Int. 16bit

 

Read Current Float Value (Registers 31'001 to 31'008)

 

Example:

Transmit

01 04 79 18 00 08 68 97

Receive

01 04 10 e6 3a 33 42 bb 93 bf 41 ff ff ff f7 00 00 00 00 97 8a

 

Field

Bytes

Value

Description

Checksum

2

CRC

CRC Checksum





RTU number

1

0x01

Modbus RTU Address

Function code

1

0x04

Read Discret Inputs

Starting address

2

0x7918

= 31'000 ( Attention! register number – 1 )

Quantity of input registers

2

0x0008

= 8, means read 8 registers


Byte count

1

0x10

= 16 ≙ 2 * N, means numbers of returned bytes

Input registers

 

2 * N

0x4233ae6

= 44.81 %rh Humidity

0x41bf93bb

= 23.95 °C Temperature

0x7fffffff

= NAN (calculation is disabled)


0x0000

= 0, No measurement error


0x0000

= 0, No measurement error

 

For detailed information about Modbus protocol Read Discrete Inputs see: (http://modbus.org/docs/Modbus_Application_Protocol_V1_1b3.pdf).

 

Device Specific holding Registers

Via the Modbus Holding Registers you can read and write device specific data of the HCD probe.

 

Assisted Modbus commands are Read Holding Registers (0x03), Write Single Register (0x06)

Function 03/06 – Read/Write Single register

Register

Name

Description

Data type

40001

Device address

Device address (Default 0x00F7)

Integer 16-bit

40002

Byte Order

Swap modes / Byte Order (Default 0x0000 - No swap)

Integer 16-bit

 

Read Modbus Address (Registers 40'001)

 

Example:

Note: the device answers to address 0. This can be used to get the current device address

Transmit

00 03 9c 40 00 01 aa 5f

Receive

01 03 02 00 01 79 84

 

Field

Bytes

Value

Description

Checksum

2

CRC

CRC Checksum





RTU number

1

0x01

Modbus RTU Address

Function code

1

0x03

Read Holding Register

Starting address

2

0x9c40

= 40001 ( Attention! register number – 1 )

Quantity of Holding registers

2

0x0001

= 1, means read 1 register


Byte count

1

0x02

= 2 ≙ 2 * N, means numbers of returned bytes

Holding register

 

N

0x0001

= 1, current address

 

 

Write Modbus Adress (Registers 40'0001)

 

Example:

Note: The device answers with the current Modbus RTU Address, afterwards the address is changed.

 

Transmit

F7 06 9C 40 00 01 73 18

Receive

F7 06 9C 40 00 01 73 18

 

 

Field

Bytes

Value

Description

Checksum

2

CRC

CRC Checksum





RTU number

1

0x01

Modbus RTU Address

Function code

1

0x03

Read Holding Register

Starting address

2

0x9c40

= 40001 ( Attention! register number – 1 )

Value

2

0x0001

= 1, new Modbus address

 

 

Byte Order / Swap modes

Selectable Swap Modes for Rotronic Devices

Selectable swap modes only for 32-bit Float and 32-bit Integer values based on Little Endian memory organisation.

 

Value

Swap Mode

Source Bytes

Target Bytes

0x0000

Big endian - No Swap

[ a b ] [ c d ]

[ a b c d ]

0x0001

Little endian - byte and word swap

[ a b ] [ c d ]

[ d c b a ]

0x0002

Mid-big endian - byte swap

[ a b ] [ c d ]

[ b a d c ]

0x0003

Mid-little endian - word swap

[ a b ] [ c d ]

[ c d a b ]

 

Read Swap mode (Registers 40'001)

 

Example:

Transmit

01 03 9c 41 00 01 fa 4e

Receive

01 03 02 00 02 39 85

 

Field

Bytes

Value

Description

Checksum

2

CRC

CRC Checksum





RTU number

1

0x01

Modbus RTU Address

Function code

1

0x03

Read Holding Register

Starting address

2

0x9c41

= 40002 ( Attention! register number – 1 )

Quantity of Holding registers

2

0x0001

= 1, means read 1 register


Byte count

1

0x02

= 2 ≙ 2 * N, means numbers of returned bytes

Holding register

 

N

0x0002

= 2, Mid-big endian - byte swap

 

 

Example:

Set Swap Mode “Mid-big endian - byte swap”

Transmit

01 06 9c 41 00 02 76 4f

Receive

01 06 9c 41 00 02 76 4f

 

Field

Bytes

Value

Description

Checksum

2

CRC

CRC Checksum





RTU number

1

0x01

Modbus RTU Address

Function code

1

0x06

Write Holding Register

Starting address

2

0x9c41

= 40002 ( Attention! register number – 1 )

Value

2

0x0002

= 2, Mid-big endian - byte swap


 

 

 

 

Data format

Serial number (unsigned int): 0…232-1

Humidity (unsigned int): 0…10000 corresponding to 0.00…100.00 %rh

Temperature (signed int): -4000…+8500 corresponding to -40.00…+85.00 °C

 

 

Response in the event of an error

Probe address


Error code

MODBUS CRC

0x00

0x84

0x00

0x0000

 

Error codes


0x02

Start address and number of records invalid

0x03

Number of records invalid

 

 

Sensor faults

In case of a short circuit or open circuit at the probe, a value of 19999 is output for the measured value concerned.

 

Connection timeout: When TCP connection is open and for more than 30 seconds no communication is performed, the device automatically closes the TCP connection. In case of a communication interruption, this prevents the socket being blocked.

 

Additional MODBUS details can be found here: MODBUS in RMS, including Guidance for MODBUS Communication with the RMS-HCD Digital Probe.