Modbus Communication Examples - GMP251

GMP251 User Guide

Document code
M211799EN
Revision
G
Language
English (United States)
Product
GMP251
Document type
User guide

Reading CO2 Value

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

The values returned by the device differ depending on the ambient conditions and/or device settings. Your device might not return exactly same values.

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 GMP25x address F0hex GMP25x address
03hex Function (Read Holding Registers) 03hex Function (Read Holding Registers)
00hex Register address 04hex Number of data bytes
00hex D4hex Value of first register (least significant word)
00hex Number of 16-bit registers to read (2) 7Ahex
02hex 43hex Value of second register (most significant word)
D1hex Modbus RTU checksum E8hex
2Ahex 33hex Modbus RTU checksum
(silence for 3.5 bytes) End of Modbus RTU frame ABhex
(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 43E8D47Ah, which is binary32 representation of 465.65997 (ppm).

Writing Volatile Compensation Pressure 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 GMP25x address F0hex GMP25x address
10hex Function (Write Multiple Registers) 10hex Function (Write Multiple Registers)
02hex Register address 02hex Register address
08hex 08hex
00hex Number of registers to write (2) 00hex Number of 16-bit registers written (2)
02hex 02hex
04hex Number of data bytes D4hex Modbus RTU checksum
50hex Value for the first register (least significant word) 93hex
00hex (silence for 3.5 bytes) End of Modbus RTU frame
44hex Value for the second register (most significant word)

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 of out-of-range values).

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

7Dhex
0Ehex Modbus RTU checksum
B7hex
(silence for 3.5 bytes) End of Modbus RTU frame
Communication Description
Register address 521 (1-based Modbus documentation format) = 0208hex (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 1013.25 (hPa), in binary32 format 447D5000hex.