📕
IoT Gateway User Manual
  • Prologue
  • ⭐Features
  • 4GW series IoT Gateway
  • Getting Started
  • LED Indications
  • Gateway Onboarding
    • Network
    • Device Registration
  • Gateway Configuration
    • Overview
    • Activity
    • Settings
      • Network
      • Data Routes
      • Input Configuration
      • MODBUS
      • System
    • OTA Updates
    • Output Connection
    • Modbus Query
    • Modbus Address Mapping
    • Modbus Datatypes & Function Codes
Powered by GitBook
On this page
  • Modbus query command
  • Things required to make Modbus query
  • Modbus query format
  • How to choose function code
  • How to choose starting address & number of registers
  • How to choose the data type
  • Index
  • Example Queries
  1. Gateway Configuration

Modbus Query

A guide on how to frame a Modbus query

Modbus query command

[[Modbus query 1],[Modbus query 2],.....]

Things required to make Modbus query

  • Slave ID

  • Function code

  • Starting address

  • How many registers/coils want to be read

  • Data type

  • Index

Modbus query format

[ Slave ID, Function code, Starting address, No. of registers/coils want to read, Data type, Index]

How to choose function code

It depends on starting address of the register or coil.

Parameter
Register / Coil Address
Function Code

Coil status

00001 on words

1

Input Coil status

10001 on words

2

Holding register

40001 on words

3

Input holding register

30001 on words

4

How to choose starting address & number of registers

  • For eg: if we want to read the parameters like Watts Total, Watts R phase, Watts Y phase, Watts B phase, and VAR Total from the Elmeasure EN8400 Energy meter then its address is from 40101 to 40110. so now the starting address would be 100 & no. of registers want to read would be 10.

  • NOTE: The number of register would be 2 in order to read single parameter of data type float, UINT32, INT32 & for rest it would be 1.

How to choose the data type

  • Supported data types & formats are:

    Datatypes case no
    Datatype
    Remark

    0

    Float ABCD

    1

    Float DCBA

    2

    Float BADC

    3

    Float CDAB

    Generally, the datatype mentioned in the datasheet will be without data format[A, B, C, D sequence], for example, datatype is float. In that case, use this format[default].

    4

    UINT ABCD

    5

    UNIT DCBA

    6

    UINT BADC

    7

    UINT CDAB

    Generally, the datatype mentioned in the datasheet will be without data format[A, B, C, D sequence], for example, datatype is UINT32. In that case, use this format[default].

    8

    INT ABCD

    9

    INT DCBA

    10

    INT BADC

    11

    INT CDAB

    Generally, the datatype mentioned in the datasheet will be without data format[A, B, C, D sequence], for example, datatype is INT32. In that case, use this format[default].

    12

    INT AB

    Generally, the datatype mentioned in the datasheet will be without data format[A, B sequence], for example, datatype is INT16. In that case, use this format[default].

    13

    INT BA

    14

    UINT AB

    Generally, the datatype mentioned in the datasheet will be without data format[A, B sequence], for example, datatype is UINT16. In that case, use this format[default].

    15

    UINT BA

  • In case of Coil status or input Coil status data type is not mandatory, we can choose default data type 0.

  • Note: In some exceptional cases even after selecting the [default] data format, we will observe that we are not receiving data from the slave in that scenario we have to do a trial & error by selecting a different data format until we will receive the data.

Index

Index number is nothing but a number of queries you have? The first query index is 0.

Example Queries

Schneider meter EM6436

UART: {"action":"modbus", "mb_mode":"1", "baud":"4800", "data_bits":"8", "parity":"EVEN", "stop_bits":"1", "mb_interval":"2000", "mb_timeout":"1000"}

[[1,3,3000,20,3,0], [1,3,3030,20,3,1], [1,3,3060,20,3,2], [1,3,3090,20,3,3], [1,3,3120,4,3,4], [1,3,3150,4,3,5]]

PreviousOutput ConnectionNextModbus Address Mapping

Last updated 1 year ago