Configuring Modbus Registry Mapping

Configuring Modbus Registry Mapping

In Zoho IoT, modbus registry mapping can be configured individually for each datapoint definition of a peripheral device product.

Prerequisites

Before configuring Modbus registry mapping, ensure the following conditions are met:
  • The datapoint definition must already be added to the device product.
  • The device product must be of the Peripheral device type.
To configure Modbus registry mapping:
  1. Access the End Application.
  2. Go to Settings > Products (under Device Management section).





  3. Select the device product for which you want to configure Modbus registry mapping. For this illustration, the device product My Peripheral Product is selected. 



  4. Click Actions > Modbus Registry Mapping.



  5. Select the datapoint to which you want to add the mapping and click Edit.



  6. Provide the required values in the appropriate fields.

    Telemetry Name
    The name used to as the parsing key once modbus registry mapping is assigned.
    Status
    Enables or disables the Modbus registry mapping for the datapoint.If disabled, the modbus registry mapping will not be sent in the edge configuration.
    Address
    The register address of the parameter as specified in the device's datasheet.
    Register Type
    The Modbus register type corresponding to the parameter's address.
    Modbus Data Type
    The data format in which the parameter value is stored in the register.
    Multiplier
    The scaling factor applied to the raw register value. The default value is 1.
    Offset
    A fixed value added to the scaled result to adjust the final reading. The default value is 0.
    Endianness
    The byte order in which the register value is stored and transmitted.
    Access Direction
    Specifies whether the gateway reads from or writes to the register.
         Learn more about each field in detail.

         
  1. Click Update.


The Modbus registry mapping will be assigned to the selected datapoint. 

Bulk Modbus Registry Mapping

When multiple datapoints require Modbus registry mapping, you can import them in bulk using a JSON or CSV file.
The recommended workflow is:

I. Downloading the modbus configuration file of the added datapoints

  1. Go to the End Application.
  2. Go to Settings > Products (under Device Management section).





  3. Click on the device product for which you want to configure Modbus registry mapping. For this illustration, the device product My Peripheral Product is selected. 



  4. Click Actions > Modbus Registry Mapping.



  5. Click Actions > Import.



  6. Select the format you want to download the configuration as:

    • JSON to download a JSON file, or

    • CSV to download a CSV file.



  7. Click Export Current Configuration. A file of the selected format will be downloaded.  


The downloaded file will contain all available keys with null or default values. You will need to update the values of the corresponding keys as illustrated in the next step.

II. Updating the values in the configuration file

  1. Open the JSON or CSV file in a code editor.
  2. Provide the appropriate values, The tables below describe the accepted values for each field.

Field

Required Value

Corresponding Input

Example

telemetry_name

The parsing key of the datapoint, without the {EdgeKey} notation, as configured in the device product. The value must be in lowercase and separated by underscores.

String

"telemetry_name": "phase3_total_power"

id

The unique identifier of the datapoint as configured in the device product. The datapoint ID can only be obtained by downloading the configuration file and cannot be retrieved any other way.

Integer

"id": 6700000000203011

status

Set to enable or disable the mapping.

Enable: true
Disable: false

"status": true

address

The Modbus register address for the datapoint.

Integer

"address": 4001

register_type

The type of Modbus register.

Coli Status: Coils
Input Status: Discrete
Holding Register: Holding
Input Register: Input

"register_type": "Holding"

modbus_data_type

The data type of the register value.

Signed Integer 16: Int16

Signed Integer 32: Int32

Signed Integer 64: Int64

Unsigned Integer 16: UInt16

Unsigned Integer 32: UInt32

Unsigned Integer 64: UInt64

Float 32: Float32

Double 64: Float64

Unsigned Integer 8 MSB: UInt8_M

Unsigned Integer 8 LSB: UInt8_L

Signed Integer 8 MSB: Int8_M

Signed Integer 8 LSB: Int8_L

"modbus_data_type": "Int32"

multiplier

A scaling factor applied to the raw register value. Defaults to 1.

Integer

"multiplier": 1

offset

A value added to the scaled result after the multiplier is applied. Defaults to 0.

Float

"offset": 0

endianness

The byte order used to read the register value.

Big Endian (AB): AB

Little Endian (BA): BA

Big Endian (ABCD): ABCD

Mid-Big Endian (BADC): BADC

Mid-Little Endian (CDAB): CDAB

Little Endian (DCBA): DCBA

Double Big Endian (ABCDEFGH): ABCDEFGH

Double Little Endian (HGFEDCBA): HGFEDCBA

Double Big Endian Byte Swap (BADCFEHG): BADCFEHG

Double Little Endian Byte Swap (GHEFCDAB): GHEFCDAB

 

"endianness": "AB"

access_direction

The read/write permission for the register.

Read: R

Write: W

Read & Write: RW

"access_direction": "RW"

Notes Note: The 'id' value is unique for each datapoint and can be obtained only by exporting the configuration. 

Here is an example of JSON and CSV configuration files updated with the values for the following datapoints:

  • phase3_active_power is mapped to address 4001 as a 32-bit signed integer with Big Endian (AB) byte order and read/write access.

  • phase1_voltage is mapped to address 4003 as a 32-bit float with Big Endian (ABCD) byte order and read-only access.

  • motor_torque is mapped to address 4005 as a 16-bit signed integer with Little Endian (BA) byte order, a multiplier of 10, an offset of 5, and read-only access. The mapping is currently disabled (status: false).



JSON Example

[
  {
    "telemetry_name": "Motor Torque",
    "id": 6700000000203011,
    "status": true,
    "address": 4001,
    "register_type": "Holding",
    "modbus_data_type": "Int32",
    "multiplier": 1,
    "offset": 0,
    "endianness": "AB",
    "access_direction": "RW"
  },
  {
    "telemetry_name": "Phase3 Active Power",
    "id": 6700000000203016,
    "status": true,
    "address": 4003,
    "register_type": "Holding",
    "modbus_data_type": "Float32",
    "multiplier": 1,
    "offset": 0,
    "endianness": "ABCD",
    "access_direction": "R"
  },
  {
    "telemetry_name": "phase1_voltage",
    "id": 6700000000203019,
    "status": false,
    "address": 4005,
    "register_type": "Input",
    "modbus_data_type": "Int16",
    "multiplier": 10,
    "offset": 5,
    "endianness": "BA",
    "access_direction": "R"
  }
]
CSV Example

telemetry_name,id,status,address,register_type,modbus_data_type,multiplier,offset,endianness,access_direction
Motor Torque,6700000000203011,true,4001,Holding,Int32,1,0,AB,RW
Phase3 Active Power,6700000000203016,true,4003,Holding,Float32,1,0,ABCD,R
phase1_voltage,6700000000203019,false,4005,Input,Int16,10,5,BA,R

III. Importing the updated configurations

After updating the configurations, import them back in to complete the bulk update.
  1. Go back to the application, click Browse and select the updated file. The contents will be populated in the JSON/CSV display panel.







  2. Click Validate and Preview. A validation summary will appear confirming whether all values are correctly filled in.



  3. You can make inline edits if minor corrections are needed. 



  4. You can choose to exclude/include a particular modbus registry configuration by clicking Exclude/Include under the Actions column.



  5. Once you've reviewed and finalised the values, click Validate and Apply.



 The modbus registry configuration will be mapped to the corresponding datapoint. 
NotesNote: If there are too many validation errors, update the values in the downloaded JSON/CSV file and re-import it.