Skip to content

Modbus/RTU Master

Parameters

Parameter Datatype Default Value Description
DEBUG enum 0 Enable debugging
DUMP enum 0 Enable communication dump
TTY tty Communication interface
BAUDRATE enum 115200 Baud rate
PARITY enum even Parity
INTERFRAME_DELAY float 0.0 Interframe delay (0 = 3.5x character-time) [s]
SCAN_PERIOD float 1 Scan period [s]
RESPONSE_TIMEOUT float 0.5 Receive timeout [s]
N_SUCCESSIVE_FAILURES_TO_IGNORE integer 0 Number of successive scan failures to ignore
TRIGGER enum auto Scan trigger
WRITE_MODE enum change Default command write mode
MERGE_WRITES enum 1 Merge writes to successive registers
PREFER_FC6 enum 0 Prefer FC6 over FC16 for 1-register writes
LOCKING enum 0 Lock tty during modbus transactions

Measurements

This stack supports measurements.

Measurement address

Type: regex

Description:

<unit-address>/[datatype@]<address-space>:<reference>, where:
    - unit-address is a modbus slave address
    - datatype is used to define object layout if it spans multiple registers
        - format: <S|U|F|X|D><L|B><1|2|4>, where:
            - S - signed
            - U - unsigned
            - F - floating point
            - X - floating point (order 2143)
            - D - discrete
            - L - little-endian (LOW before HIGH)
            - B - big endian (HIGH before LOW)
            - 1 - size is 1 register/coil/discrete input
            - 2 - size is 2 registers/coils/discrete inputs
            - 4 - size is 4 registers/coils/discrete inputs
        - Unsupported datatypes: FL1, FB1, XL1, XB1, DL4, DB4
    - address-space is modbus address space number (0 - coils, 1 - discrete inputs, 3 - input registers, 4 - holding registers)
    - reference is 1-based register, coil or discrete input number in given address space

Examples:

3/3:1000 - input register 1000 on slave 3 with default datatype (16-bit unsigned)
7/1:550 - discrete input 550 on slave 7
10/fb4@4:1310 - holding registers 1310,1311,1312,1313 on slave 10 mapped as 64-bit big-endian floating-point value
11/dl2@0:35 - coils 35,36 on slave 11 mapped as 2-bit (quaternary) in little-endian (LSB, MSB) order

Commands

This stack supports commands.

Command address

Type: regex

Description:

<unit-address>/[datatype@]<address-space>:<reference>[!<write-mode>], where:
    - unit-address is a modbus slave address
    - datatype is used to define object layout if it spans multiple registers
        - format: <S|U|F|X|D><L|B><1|2|4>, where:
            - S - signed
            - U - unsigned
            - F - floating point
            - X - floating point (order 2143)
            - D - discrete
            - L - little-endian (LOW before HIGH)
            - B - big endian (HIGH before LOW)
            - 1 - size is 1 register/coil/discrete input
            - 2 - size is 2 registers/coils/discrete inputs
            - 4 - size is 4 registers/coils/discrete inputs
        - Unsupported datatypes: FL1, FB1, XL1, XB1, DL4, DB4
    - address-space is modbus address space number (0 - coils, 4 - holding registers)
    - reference is 1-based register, coil or discrete input number in given address space
    - write-mode is one of: change, trigger, change-and-trigger

special addresses: @trigger

Examples:

3/4:1000 - holding register 1000 on slave 3 with default datatype (16-bit unsigned)
7/0:550 - coil 550 on slave 7
10/fb4@4:1310 - holding registers 1310,1311,1312,1313 on slave 10 mapped as 64-bit big-endian floating-point value
11/dl2@0:35 - coils 35,36 on slave 11 mapped as 2-bit (quaternary) in little-endian (LSB, MSB) order
@trigger - triggering command, shall be binary