Skip to main content

ModBus smartCORE module

Description

The "modbus" module primarily reads the ModBus registers of ModBus devices. These devices can be

  • via a serial connection (ModBus/RTU)
  • via TCP (ModBus/TCP)

be connected.

Interfaces & protocols used

  • ModBus

JSON configuration

The following section describes the entire JSON configuration of the module and explains the individual parameters.

Example configuration

An example ModBus/TCP configuration is shown below:

    {
"module": "ModBus",
"comment": "ModBus/TCP config",
"factory": "modbus",
"config": {
"version": 1,
"type": "modbus",
"enable": true,
"pollCycleInMilliseconds": 1000,
"transport": {
"type": "tcp",
"ipAddress": "192.168.0.1",
"ipPortNumber": 502,
"timeoutInMilliseconds": 200
},
"devices": [
{
"enable": true,
"deviceName": "Device Name",
"deviceAddress": 1,
"readChannels": [
{
"name": "Channel Name",
"address": 49152,
"registerType": "HoldingReg",
"registerFormat": "REAL",
"byteOrder": "ABCD",
"bitOffset": 0,
"unit": "",
"scale": 1.0,
"offset": 0.0
}
]
}
]
}
}

Global module parameters

Parameter nameRequiredData typeMeaningful value rangeDefaultDescription
versionYESINT1-ModBus protocol version
typeYESSTRING"modbus"-Serial interface for communication
enableYESBOOLtrue-Switch for production of data in smartCHANNELs
pollCycleInMillisecondsYESINT1 --polling interval [ms] of ModBus accesses
transportYESJSON object-configuration of the ModBus transport layer (see below)
devicesYESJSON array of JSON objects-List of ModBus participants

ModBus/TCP specific transport parameters ("transport")

Parameter NameRequiredData TypeMeaningful Value RangeDefaultDescription
typeYESSTRING"tcp"Selection ModBus/TCP
ipAddressYESSTRINGValid IP addressIP address of the ModBus device
ipPortNumberYESINTValid IP port numberIP port number of the ModBus device (should be set to 502 unless otherwise specified)
timeoutInMillisecondsYESINT1 -Timeout [ms] for TCP connection (should be set to 200 unless otherwise specified)

ModBus/RTU specific transport parameters ("transport")

Parameter nameRequiredData typeMeaningful value rangeDefaultDescription
typeYESSTRING"rtu"Selection ModBus/RTU
baudRateYESINTValid ModBus baud rateBaud rate of the serial interface
dataBitsYESINT5 - 8Data bits of the serial interface
encodingYESSTRING"rtu"Encoding of the ModBus data (only "rtu" is supported)
parityYESSTRING"no", "even", "odd"Parity of the serial interface
stopBitsYESDOUBLE1.0, 1.5, 2.0Stop bits of the serial interface
portNameYESSTRINGValid device fileDevice file of the serial interface
terminationResistorYESBOOLtrue, falseSwitch for INTERNAL termination resistor
timeoutInMillisecondsYESINT1 -Timeout [ms] for TCP connection (should be set to 200 unless otherwise specified)
deviceTimeoutInMillisecondsNoINT0 -0Additional timeout [ms] between the queries of different ModBus participants

ModBus device parameters ("devices")

Parameter NameRequiredData TypeMeaningful Value RangeDefaultDescription
enableYESBOOLtrueSwitch for activating the ModBus device
deviceNameYESSTRINGName of the ModBus device
deviceAddressYESINT1 -Address of the ModBus device
readChannelsYESJSON Array of JSON objectssee below

ModBus channel configuration ("readChannels")

Parameter nameRequiredData typeMeaningful value rangeDefaultDescription
nameYESSTRINGname of the smartCHANNEL
addressYESINTAddress of the ModBus register
registerTypeYESSTRINGValid ModBus register typeType of ModBus register ("InputReg", "HoldingReg", "Coil", "Status", "0x17" (read access only))
registerFormatYESSTRINGValid ModBus register formatFormat of the ModBus register ("I8", "I16", "I32", "I64", "UI8", "UI16", "UI32", "UI64", "REAL", "BOOL")
byteOrderYESSTRINGByte order of the ModBus register ("A" = MSB, "B" or "D" = LSB)
bitOffsetYESUINTBit offset of the value to be interpreted
unitYESSTRINGUnit of the smartCHANNEL
scaleYESDOUBLEScaling of the smartCHANNEL
offsetYESDOUBLEOffset of the smartCHANNEL

ModBus channel configuration ("readChannelGroups")

Alternatively, several channel configurations can be combined into a JSON array, so that the ModBus registers on which this group is based can be read in a single step can be read in a single step (if the register type is identical). This readChannelGroup array combined in this way can then be listed in the JSON array of the "readChannelGroups", e.g.

"readChannelGroups": [
[
{
"name": "Channel 1",
"address": 49152,
"registerType": "HoldingReg",
"registerFormat": "REAL",
"byteOrder": "ABCD",
"bitOffset": 0,
"unit": "",
"scale": 1.0,
"offset": 0.0
},
{
"name": "Channel 2",
"address": 49158,
"registerType": "HoldingReg",
"registerFormat": "REAL",
"byteOrder": "ABCD",
"bitOffset": 0,
"unit": "",
"scale": 1.0,
"offset": 0.0
}
]
]

Alternatively, "readChannels" or "readChannelGroups" can be specified.

Module information

InformationValue
AuthorsoptiMEAS Measurement and Automation Systems GmbH
since smartCORE0.1
Module typeProducer
DependenciesNONE