Skip to main content

Modbus

Modbus is a communication protocol utilized in PLC networks. Originally developed for serial interfaces like RS232, RS422, and RS485, it was later expanded to include TCP mode. OIBus uses the jsmodbus library in TCP mode only.

Specific Settings

Connection Configuration

SettingDescriptionExample Value
HostIP address or hostname of the Modbus server machine.192.168.1.100
PortPort to use for connection (502 by default).502
Connection timeoutMaximum time to wait for a connection (in milliseconds).10000
Retry intervalTime to wait (in milliseconds) between reconnections after a connection failure.5000
Slave IDIdentifies the Modbus source machine (default is 1).1
Address offsetFor most PLCs, there is no offset (Modbus option). Some PLCs may start the address range at 1 instead of 0 (JBus option)Modbus

Data Format Options

SettingDescription
EndiannessSpecifies the type of bit encoding (Big Endian or Little Endian).Big Endian
Swap BytesDetermines whether the bytes within a group of 16 bits (a word) should be inverted or not.Enabled/Disabled
Swap WordsIndicates whether the words (16-bit groups) should be inverted or not within a 32-bit group.Enabled/Disabled

Item Settings

SettingDescriptionExample Value
AddressHexadecimal address of the data within the device (without the data type digit).0x0001
Modbus typeSpecifies whether it's a coil, discrete input, input register, or holding register (default).Holding Register
Data typeRelevant for holding registers or input registers. Defines the type of data fetched from the register (Bit, UInt16, Int16, UInt32, Int32, UInt64, Int64, Float, Double).UInt16
Bit index(Bit data type only) The index of the bit to retrieve from the read value (0 to 15).0 to 15
Multiplier CoefficientMultiplies the retrieved value (default is 1).1
About Modbus Addresses

The address should match the variable's address in the PLC, represented in hexadecimal without the data type digit.

Examples:

  • For holding register data at 0x40001, input the address as 0x0001 and specify the Modbus type as holdingRegister
  • For coil data at 0x009C, use 0x009C as the address and specify the Modbus type as coil

Address Ranges (Modicon Convention Notation):

TypeStandard RangeExtended Range
Coil0x00001 - 0x099990x000001 - 0x065535
Discrete Input0x10001 - 0x199990x100001 - 0x165535
Input Register0x30001 - 0x399990x300001 - 0x365535
Holding Register0x40001 - 0x499990x400001 - 0x465535

For more details, see the Modicon Convention Notation (MCN).