Modbus Register Definitions

This guide details Modbus Register Definitions, covering both input and holding registers. Learn about function codes and how to read 3-axis acceleration data from a 6DOF IMU sensor.

Register Definitions

Register Type Register Address Name R/W Data Range Default Description
Input Register 0x0000 VID R 0x3343 0x3343 VID (Vendor: DFRobot)
Input Register 0x0001 PID R 0x0006 0x0006 PID Vendor ID
Input Register 0x0002 Device Address R 0x004A~0x004D 0x004A MODBUS device address, configurable via DIP switch
Input Register 0x0003 Reserved R 0x0000~0xFFFF 0xFFFF Reserved
Input Register 0x0004 Module Parity(H) Stop Bits(L) R 0x0001 0x0001 Module Parity (High Byte)
0x00 – None
Stop Bits (Low Byte)
0x01 – 1 Byte
Input Register 0x0005 Software Version R 0x0000~0xFFFF 0x1000 0x1000 means software version V1.0.0.0
Input Register 0x0006 Accelerometer X R 0x0000~0xFFFF 0x0000 Accelerometer X-axis data for 6DOF IMU
Input Register 0x0007 Accelerometer Y R 0x0000~0xFFFF 0x0000 Accelerometer Y-axis data for 6DOF IMU
Input Register 0x0008 Accelerometer Z R 0x0000~0xFFFF 0x0000 Accelerometer Z-axis data for 6DOF IMU
Input Register 0x0009 Gyroscope X R 0x0000~0xFFFF 0x0000 Gyroscope X-axis data for 6DOF IMU
Input Register 0x000A Gyroscope Y R 0x0000~0xFFFF 0x0000 Gyroscope Y-axis data for 6DOF IMU
Input Register 0x000B Gyroscope Z R 0x0000~0xFFFF 0x0000 Gyroscope Z-axis data for 6DOF IMU
Input Register 0x0014 INT1 Status R 0x0000~0x3000 0x0000 Interrupt pin 1 status for 6DOF IMU
0x0001 – No-motion detect interrupt
0x0002 – Any-motion detect interrupt
0x0004 – Flat detect interrupt
0x0008 – Orientation detect interrupt
0x0010 – Step detect interrupt
0x0040 – Significant motion detect interrupt
0x0080 – Tilt detect interrupt
0x0100 – Tap detect interrupt
0x3000 – Basic data ready interrupt
Input Register 0x0015 INT2 Status R 0x0000~0x3000 0x0000 Interrupt pin 2 status for 6DOF IMU
0x0001 – No-motion detect interrupt
0x0002 – Any-motion detect interrupt
0x0004 – Flat detect interrupt
0x0008 – Orientation detect interrupt
0x0010 – Step detect interrupt
0x0040 – Significant motion detect interrupt
0x0080 – Tilt detect interrupt
0x0100 – Tap detect interrupt
0x3000 – 6DOF data ready interrupt
Input Register 0x0018 Pedometer Low Word R 0x0000~0xFFFF 0x0000 Pedometer low word for 6DOF IMU
Input Register 0x0019 Pedometer High Word R 0x0000~0xFFFF 0x0000 Pedometer high word for 6DOF IMU
Input Register 0x001A Tap Status R 0x0000~0x0003 0x0000 Tap status data for 6DOF IMU
0x0001 – Single tap interrupt
0x0002 – Double tap interrupt
0x0003 – Triple tap interrupt
Input Register 0x001B Orientation Data R 0x0000~0xFFFF 0x0000 Orientation status data for 6DOF IMU
Orientation (H)
0x01 – Portrait Up
0x02 – Landscape Left
0x03 – Landscape Right
0x04 – Portrait Down
Face (L)
0x00 – Face Forward
0x01 – Face Backward
Input Register 0x001C Roll Low Word R 0x0000~0xFFFF 0x0000 Roll angle low word for 6DOF IMU attitude
Input Register 0x001D Roll High Word R 0x0000~0xFFFF 0x0000 Roll angle high word for 6DOF IMU attitude
Input Register 0x001E Pitch Low Word R 0x0000~0xFFFF 0x0000 Pitch angle low word for 6DOF IMU attitude
Input Register 0x001F Pitch High Word R 0x0000~0xFFFF 0x0000 Pitch angle high word for 6DOF IMU attitude
Input Register 0x0020 Yaw Low Word R 0x0000~0xFFFF 0x0000 Yaw angle low word for 6DOF IMU attitude
Input Register 0x0021 Yaw High Word R 0x0000~0xFFFF 0x0000 Yaw angle high word for 6DOF IMU attitude
Holding Register 0x0000 Reserved R/W 0x0000~0xFFFF 0xFFFF Reserved
Holding Register 0x0001 Reserved R/W 0x0000~0xFFFF 0xFFFF Reserved
Holding Register 0x0002 Reserved R/W 0x0000~0xFFFF 0xFFFF Reserved
Holding Register 0x0003 Baud Rate R/W 0x0000~0x00FF 0x0003 Device baud rate
0x0001 – 2400
0x0002 – 4800
0x0003 – 9600
0x0004 – 14400
0x0005 – 19200
0x0006 – 38400
0x0007 – 57600
0x0008 – 115200
Other – 115200
Input Register 0x0004 Reserved R 0x0000~0xFFFF 0xFFFF Reserved
Holding Register 0x0005 Reserved R/W 0x0000~0xFFFF 0xFFFF Reserved
Holding Register 0x0006 Operating Mode R/W 0x0000~0x0003 0x0002 0x0000 – Sleep mode (lowest power, sensor config lost)
0x0001 – Low power mode (measure with low power consumption)
0x0002 – Normal mode (balance accuracy and power)
0x0003 – High performance mode (highest accuracy, highest power)
Holding Register 0x0007 Factory Reset R/W 0x0000~0x0001 0x0001 Factory reset. Write 0x0001 to trigger factory reset
Holding Register 0x0008 Accelerometer Range R/W 0x0000~0x0003 0x0002 Accelerometer measurement range
0x0000 – ±2G
0x0001 – ±4G
0x0002 – ±8G
0x0003 – ±16G
Holding Register 0x0009 Gyroscope Range R/W 0x0000~0x0004 0x0004 Gyroscope measurement range
0x0000 – ±125 DPS
0x0001 – ±250 DPS
0x0002 – ±500 DPS
0x0003 – ±1000 DPS
0x0004 – ±2000 DPS
Holding Register 0x000E INT1 Config R/W 0x0000~0x0009 0x0000 Interrupt pin 1 config for 6DOF IMU
0x0000 – Interrupt disabled
0x0001 – 6DOF data ready interrupt enable
0x0002 – Any-motion detect interrupt enable
0x0003 – No-motion detect interrupt enable
0x0004 – Significant motion detect interrupt enable
0x0005 – Step detect interrupt enable
0x0006 – Flat detect interrupt enable
0x0007 – Orientation detect interrupt enable
0x0008 – Tap detect interrupt enable
0x0009 – Tilt detect interrupt enable
Holding Register 0x000F INT2 Config R/W 0x0000~0x0009 0x0000 Interrupt pin 2 config for 6DOF IMUSame as INT1

Common Function Codes for Modbus-RTU:

Function Code Name Function
0x03 Read Multiple Registers Read integer, character, status word, floating-point (read N words) --- Read holding registers, byte operation
0x04 Read Input Registers Read integer, status word, floating-point (read N words) --- Read input registers, byte operation
0x06 Write Single Holding Register Write integer, character, status word, floating-point (write one word) --- Write holding register, byte operation
0x10 Write Multiple Holding Registers Write multiple holding registers --- Load specific binary values into a series of consecutive holding registers

Input and holding registers can be read and written using the above commands.

Example of Reading 3-Axis Acceleration Data

Objective

Read the current acceleration values detected by the 6-axis IMU sensor via the Modbus RTU protocol.

Hardware Preparation

General Operation Steps

  • Hardware Connection: Connect the sensor to the host (computer) via the RainbowLink USB protocol converter. Switch the sensor's communication mode to UART and the address to 0x4A.

  • Parameter Configuration: Set the following parameters in the serial port debugging tool (must match the sensor settings):

    • Baud rate: 9600 (default)
    • Data bits: 8 bits
    • Stop bits: 1 bit
    • Parity: None
  • Send Command: Enter the following hexadecimal command in the "Transmission Area" of the debugging tool, check "Send in Hexadecimal", and send the command.

Command Transmission and Parsing

Field Name Hexadecimal Value Description
Device Address 4A MODBUS device address, default 0x4A (modifiable via DIP switch)
Function Code 04 Read Input Registers (fixed command)
Starting Register Address 00 06 Acceleration X-axis register address (0x0006)
Number of Registers 00 03 Read 3 registers (Acceleration X, Y, Z)
CRC Check 5F B1 CRC16 check value of the command

Complete Command to Send: 4A 04 00 06 00 03 5F B1

Return Data and Parsing

After receiving the command, the sensor returns the following data (example):

Field Name Hexadecimal Value Description
Device Address 4A Matches the device address in the sent command
Function Code 04 Confirm execution of "Read Input Registers" operation
Number of Bytes 06 Total number of bytes in the returned data (6 bytes)
Read Data FF AD FF DD EF E1 Raw values of acceleration X, Y, Z axes (2 bytes each)
CRC Check B7 E1 CRC16 check value of the returned data

Complete Returned Data: 4A 04 06 FF AD FF DD EF E1 B7 E1

SEN0692-Modbus Result

Data Parsing Steps

The returned raw data (FF AD, FF DD, EF E1) are 16-bit signed integers (two's complement). Convert them to actual acceleration values (unit: g) following these steps:

  1. Convert Hexadecimal to Signed Decimal

    • X-axis raw value: FF AD
      Unsigned value = 0xFFAD = 65453
      Signed value = 65453 − 65536 = -83

    • Y-axis raw value: FF DD
      Unsigned value = 0xFFDD = 65493
      Signed value = 65493 − 65536 = -43

    • Z-axis raw value: EF E1
      Unsigned value = 0xEFE1 = 61409
      Signed value = 61409 − 65536 = -4127

  2. Convert to Physical Values Based on Range and Sensitivity

    The default range of the BMI323 accelerometer is ±8 g, with a sensitivity of 4096 LSB/g (see Table 3 on Page 9 of the datasheet).

    Formula:

    Acceleration (g) = Signed raw value / Sensitivity

    • X-axis: −83/4096 ≈ −0.0203 g
    • Y-axis: −43/4096 ≈ −0.0105 g
    • Z-axis: −4127/4096 ≈ −1.0076 g
  3. Result Interpretation

    • X and Y axes are close to 0 g, indicating the sensor is level with no tilt on the horizontal plane.
    • Z-axis is approximately -1 g, indicating the direction of gravity is negative (sensor front side up, Z-axis pointing to the center of the Earth).
    • This data is consistent with the expected output when the sensor is stationary.

Why This Processing?

  1. Digital Output: The sensor converts analog signals to digital signals internally and outputs them as 16-bit binary two's complement. The sensitivity defined in the datasheet must be used to convert these values back to physical quantities.
  2. Range Impact: Sensitivity is related to the selected range (different ranges correspond to different LSB/g values). Confirm the current range setting before parsing (default ±8 g; if modified, read via holding register 0x0008).
  3. Significance: Acceleration has direction, so signed numbers are used. Two's complement format requires subtracting 65536 to convert to negative values.

Notes

  • If the accelerometer range is modified (e.g., ±2 g, ±4 g, ±16 g), the sensitivity will change accordingly, and the denominator in the parsing formula must be adjusted synchronously.
  • The CRC check in the returned data can verify transmission integrity (CRC is correct in this example, so the data is reliable).
  • For continuous reading, repeat sending the same command directly—the sensor will return the latest sampled values.

Was this article helpful?

TOP