Skip to main content

Modbus

Supported datatypes​

C (Coil)I (Input)IR (Input register)HR (Holding register)
Bitxxxx
Short (1 reg)xx
UShort (1 reg)xx
Int (2 reg)xx
UInt (2 reg)xx
Long (4 reg)xx
ULong (4 reg)xx
Float (2 reg)xx
Double (4 reg)xx
String (2 characters per reg)xx

Factor​

If the value needs to be divided by a number (for example because the raw value is an integer, but represents a decimal number with 2 decimal places), you can add a factor:

`HR,USHORT40,FACTOR:100' will take the unsigned short at position 40, and divide it by 100. The value 12345 is read as 123.45

String​

The number after the dot in a string mapping is the maximum length of the string in characters, not in registers. One register holds 2 characters.

HR,STRING30.10 reads a string of up to 10 characters starting at register 30, so registers 30 to 34. If the device documents the string as a number of registers, multiply that number by 2: a string of 8 registers is HR,STRING30.16.

Null characters are removed from the value, so a string shorter than its maximum length comes through without padding.

Examples​

Address starts at 0 for each register type => fe. integer located in holding reg 400001 = HR,INT0

Holding registers​

HR,BIT10.5 => reg 10, bit 5 (mind byte swapping property)

HR,DOUBLE20

HR,STRING30.10 => string of up to 10 characters, from reg 30 (regs 30 to 34)

HR,SHORT40

HR,INT45

HR,LONG50

HR,FLOAT50

Input register​

IR,BIT10.5 => reg 10, bit 5 (mind byte swapping property)

IR,DOUBLE20

IR,STRING30.10 => string of up to 10 characters, from reg 30 (regs 30 to 34)

IR,SHORT40

IR,INT45

IR,LONG50

IR,FLOAT50

Coil​

C,BIT10

Input (digital)​

I,BIT10