MODBUS Client communication protocol

Supported device types and versions
Communication line configuration
Line protocol parameters
Station configuration
I/O tag configuration
Note to FloBoss 103 device
Note to Honeywell
Literature
Changes and modifications
Document revisions

Supported device types and versions


The protocol executes client (master) communication with arbitrary devices which supports a standard MODBUS RTU and ASCII in the versions of serial communication as well as MODBUS over TCP/IP. Moreover it supports two extension:

Communication line configuration


Line protocol parameters


A dialog window of communication line configuration - Protocol parameters tab.
They influence some optional protocol parameters.

The line protocol contains the following parameters:

Tcp No Delay Setting Tcp No Delay parameter to YES causes low level socket option TCP_NODELAY being set, thus turning off default packet coalesce feature.
Parameter is immplemented only for line categories TCP/IP-TCP and TCP/IP-TCP Redundant.
YES/NO NO

Station configuration



Station protocol parameters

Configuration dialog box - tab Parameter.
They influence some optional parameters of protocol. Following station protocol parameters can be set:

Table 1

Parameter Meaning Unit Default value
Retry Count Maximum count of call retry. If no reply returns after calls had been sent, station will be in status of communication error. s 2
Retry Timeout Timeout before retry of call if no reply had not received. s 0.1
Wait First Timeout Delay after sending the request before reading the response. s 0.1
Wait Timeout Timeout between reading the reply. s 0.1
Max. Wait Retry Maximum count of retry of the reply reading. - 20
Start Silent Interval "Start silent interval" before begin of the transmission in RTU mode. ms 50
Stop Silent Interval "Stop silent interval" after ending of the transmission in RTU mode. ms 50
Byte mode Special byte mode of transmission in which the values of registers have length of 1 byte and not 2 bytes as it is defined in Modbus protocol specification. YES/NO NO
Variable mode Special variable mode of transmission in which the values of registers have variable length.

Setting of Variable mode:
Little endian = the lowest bytes are sent first
Big endian = the highest bytes are sent first
OFF = variable mode is switch off

Note 1: Variable and byte mode are incompatible and only one of them can be enabled.
Note 2: Emerson FloBoss 103 device: text strings and time stamps of 6-byte are sent always from the lowest byte.
Note 3: Variable mode is implemented only for Protocol Mode=RTU.
Note 4: A data encoding big-endian is used automatically, according to the default parameter values Byte mod=NO and Variable mode=OFF (i.e. according to MODBUS protocol specification).

OFF
Little endian
Big endian
OFF
Full debug Log of another debug information about communication on line. YES/NO NO
Protocol mode Protocol mode: RTU or ASCII.

Note: In case of "MODBUS over TCP/IP", the parameter value is ignored and Protocol Mode=RTU is used.

RTU
ASCII
RTU
Addressing model Sets an address model of MODBUS protocol:
MODBUS PDU
data are addressed from 0 up to 65535.
MODBUS data Model
data are addressed from 1 up to 65536.

Note:
MODBUS PDU is a default value. If MODBUS data Model is set, the object with the address X is addressed as X-1 in MODBUS PDU.
After you change this parameter, restart a proper communication process.
MODBUS PDU
MODBUS data Model
MODBUS PDU
TCP/IP protocol variant Select a variant of protocol in case of TCP/IP communication:
"MODBUS TCP" is a variant of communication without control checksum. Safeguarding is done by underlying TCP protocol.
"MODBUS over TCP"
is a variant where a payload is MODBUS RTU data containing a checksum.
"MODBUS TCP"
"MODBUS over TCP"
"MODBUS TCP"
Max. Registers Maximum count of registers that are required in one call. - 100
Max. Bytes Maximum count of bytes that are required in one call (only in "Byte mode"). - 100
Skip Unconfigured To require the values from addresses that are not configured, is not allowed.

Description and example:
The calls for data, which are limited by protocol parameter "Max. Registers" or "Max. Bytes", are sent as standard. If I/O tags with addresses "Holding Registers" 1, 2 and 5 has been configured, one call requiring 5 registers from address 1 is sent although the I/O tags with addresses 3 and 4 are not configured. It is more efficiency to gain required data in one call than in two ones even if the unnecessary data are also read.
If the parameter "Skip Unconfigured" is set on YES, two calls are sent, the first one requires two registers from address 1 and the second one requires the one register from address 5.

YES/NO NO
Check Receive Length If this parameter is set to YES, then an extra check is performed when receiving a response to a read request: the length of received data is checked whether it matches amount of registers in a read request:
  • if Byte mode is on (Byte mode=YES), length of received data must equal to number of registers
  • if both Byte mode and variable mode are off, length of received data must equal to double of number of registers
  • if variable mode is on (Variable mode=little-endian or big-endian), check has not been implemented yet
This extra check is reasonable on high-latency and variable-latency lines - e.g. GPRS networks - to detect and avoid the situation when read request (#1) is repeated due to timeouts and then two responses are received, the second of which could be considered to be an answer to another read request (#2), thus causing wrong values being assigned to I/O tags addressed by this read request #2.
YES/NO NO

I/O tag configuration


Possible types of I/O tag values for invariable mode: Ai, Ao, Di, Do, Ci, Co, TxtI.

Possible types of I/O tag values for variable mode: Ai, Ao, Di, Do, Ci, Cout, TxtI, TxtO, TiA.


I/O tag address:

The main address space in the protocol MODBUS is divided into following registers:

An independent address space of 2 byte, i.e. addresses from 0 up to 65535 (so called MODBUS PDU addressing model), is in each address space of given type of register. Some of devices work with address space starting with 1 (so called MODBUS data Model). In this case it is necessary to deduct -1 in address at configuration I/O tags in D2000 system or change the setting of parameter Addressing model to MODBUS data Model.

I/O tag address can acquire basic or extended format (for a variable mode).

Basic format of I/O tag address:
Address format is [I|U|Uu|Ul|f|F|L|Ll|S|Sl|B|X|sn.|an.][d][b][s]RdFn[-WrFn[d]].Address[.BitNr] in which:

  • Modifier d indicates that the number is an 8-byte number (4 consecutive registers). It can be used for types L, Ll, S, Sl, F,f and it allows configuration of 8 byte integer with/without a sign as well as an 8-byte float (variants big endian and little endian).
    Note: when using a modifier d, I/O tag must be of Analog type (Ai), because Integer type (Ci) in D2000 is implemented as a 4-byte variable and overflow might occur.
  • Modifier b indicates that figure is coded by BCD. It can be used at I/O tags of I, U, B type.
  • Modifier s indicates that a status register (Unsigned16) located on address Address is followed by a big endian Float value located on address Address+1 .. Address+2. This indicator is used for type f and it is implemented for calorimeter Endress+Hauser RMS621. Following table shows values of status register and their mapping to D2000 attributes.
    Status register D2000 attributes
    0 : Invalid value Weak
    1 : Measured value valid Valid
    2 : Overflow warning
    3 : Overflow error
    4 : Underflow warning
    5 : Underflow error
    6 : Saturated steam alarm
    7 : Error in differential pressure calculation
    8 : Wrong medium for DP calculation
    9 : Wrong value range - DP calculation inaccurate
    10 : Differential pressure - general error
    11 : Range overshoot (Tsat > 350 etc.) on
    12 : Change in state of aggregation
    26 : Differential pressure --> general error
    99 : No measured value is assigned to the register in the setup of the ModBus
    Weak
  • Parameter RdFn is a function of Modbus protocol for a data reading. The following functions are implemented:
  • Parameter WrFn is the function of Modbus protocol for a data writing. Following functions are implemented:
  • Parameter d activates the function "delayed write". Sending of the value is delayed until the request to write value of the object without parameter d comes. All accumulated request waiting to be written are sent. If the function WrFn is set on "Write Multiple Registers", the values are sent in one packet.
  • Parameter Address is 2-byte address of register (0-65536). See also the protocol parameter Addressing model.
    Note: address can be specified as a hexadecimal number using a number sign (#), e.g. #50CE
  • Parameter BitNr is number of bit in a word. The values 0-7 are allowed to be used for binary statuses and inputs, values 0-15 are allowed to be used for reading of bit from 16-bit status or input registers.

  • Note about the byte and register order

    1. MODBUS protocol uses the big-endian, i.e. the most significant byte (MSB) is transmitted as first. Examples:

    Received bytes of MSB-LSB I/O tag type Value
    0x00 0x01 I, U 1
    0xFF 0xFE I -2
    0xFF 0xFE U 65534
    0x01 0x02 B 1
    0x01 0x02 X 2

    2. When values are read from two registers as big-endian the received bytes are analysed in this way:

    Most significant register (ADR address) Least significant register (ADR+1 address)
    MSB LSB MSB LSB

    Examples:

    Received bytes of register (MSB-LSB) Received bytes of register + 1 (MSB-LSB) I/O tag type Value
    0x00 0x00 0x00 0x01 L, S 1
    0xFF 0xFF 0xFF 0xFE S -2
    0x00 0x01 0x00 0x02 L, S 65538
    0x3F 0x80 0x00 0x00 f 1.0
    0xC0 0x00 0x00 0x00 f -2.0

    3. When values are read from two registers as little-endian the received bytes are analysed in this way:

    Least significant register (ADR address) Most significant register (ADR+1 address)
    MSB LSB MSB LSB

    Examples:

    Received bytes of register (MSB-LSB) Received bytes of register + 1 (MSB-LSB) I/O tag type Value
    0x00 0x01 0x00 0x00 Ll, Sl 1
    0xFF 0xFE 0xFF 0xFF Sl -2
    0x00 0x02 0x00 0x01 Ll, Sl 65538
    0x00 0x00 0x3F 0x80 F 1.0
    0x00 0x00 0xC0 0x00 F -2.0

    Example of configuration:


    Extended format of I/O tag address:

    Address format is [xN][I|U|F|B|C|T][b]RdFn[-WrFn].Address[.BitNr] in which:

    See the example of configuration in next section.

    Note to FloBoss 103 device


    Note to Honeywell controllers


    The basic parameters and current data of these controllers are not normally read by means of functions 0x01 up to 0x04. There is necessary to use the function 0x14/0x15 Read / write configuration reference data. These controllers use "big-endian" byte order. Therefore, for proper functionality is not necessary to modify parameters that changes byte mode and endianness.

    Examples of I/O tag configuration:

    20.039 - 16-bit number from address 39(0x27)
    f20.040 - 32-bit real number from address 40(0x28)

    Literature


    Changes and modifications


    -

    Document revisions


    Communication protocols