Modbus communication examples - HMP1 - HMP3 - HMP4 - HMP5 - HMP7 - HMP8 - HMP9 - HMPX - MMP8 - MMPX - TMP1 - TMPX

HMP Series with MMP8 and TMP1 User Guide

Document code
M212022EN
Revision
K
Language
English
Product
HMP1
HMP3
HMP4
HMP5
HMP7
HMP8
HMP9
HMPX
MMP8
MMPX
TMP1
TMPX
Document type
User guide

Reading relative humidity value

Device address used in the following examples is 240 (F0hex).

Measurement values returned by the device change depending on ambient conditions and/or device settings.

Request Response
Bytes on the line (hexadecimal) Description Bytes on the line (hexadecimal) Description
(silence for 3.5 bytes) Start of Modbus RTU frame (silence for 3.5 bytes) Start of Modbus RTU frame
F0hex Probe address F0hex Probe address
03hex Function (Read Holding Registers) 03hex Function (Read Holding Registers)
00hex Register address 04hex Number of data bytes
00hex 7Ahex Value of first register (least significant word)
00hex Number of 16-bit registers to read (2) E1hex
02hex 41hex Value of second register (most significant word)
D1hex Modbus RTU checksum F4hex
2Ahex 62hex Modbus RTU checksum
(silence for 3.5 bytes) End of Modbus RTU frame 05hex
(silence for 3.5 bytes) End of Modbus RTU frame
Communication description
Register address 1 (1-based Modbus documentation format) = 0000hex (0-based format used in actual communication).
Data format Two 16-bit Modbus registers interpreted as IEEE 754 binary32 floating point value, least significant word first.
Returned value 41F47AE1hex, which is binary32 representation of 30.56 (%RH).

Writing pressure compensation value

Request Response
Bytes on the line (hexadecimal) Description Bytes on the line (hexadecimal) Description
(silence for 3.5 bytes) Start of Modbus RTU frame (silence for 3.5 bytes) Start of Modbus RTU frame
F0hex Probe address F0hex Probe address
10hex Function (Write Multiple Registers) 10hex Function (Write Multiple Registers)
03hex Register address 03hex Register address
00hex 00hex
00hex Number of registers to write (2) 00hex Number of 16-bit registers written (2)
02hex 02hex
04hex Number of data bytes 54hex Modbus RTU checksum
6Ehex Value for first register (least significant word) ADhex
14hex
44hex Value for second register (least significant word) (silence for 3.5 bytes) End of Modbus RTU frame
75hex
4Ehex Modbus RTU checksum

The response to a write function informs that the function was correctly received by the device. It does not guarantee that the written value was accepted by the device (for example, in case out-of-range values).

To verify that the value was really accepted by the device, read the register value after writing.

ABhex
(silence for 3.5 bytes) End of Modbus RTU frame
Communication description
Register address 769 (1-based Modbus documentation format) = 0300hex (0-based format used in actual communication).
Data format Two 16-bit Modbus registers interpreted as IEEE 754 binary32 floating point value, least significant word first.
Value to write 44756E14hex = 981.72 (hPa)