×
Skip to main content Link Search Menu Expand Document (external link) Right Arrow

Contents

Modbus

Modbus is an open-source client-server communication protocol commonly used for connecting programmable logic controllers (PLCs). Modbus has an official website as well as detailed documentation. Being the most popular communication protocol in industrial applications, Modbus is fully supported by the Cloud.

Device Parameters

For device parameters not covered herein, see Device-Based Tags.

TCP address or host name

TCP/IP address of the Modbus server on the local network:

192.168.X.X

Alternatively, if the server has a host name, it can be entered as a string:

modbuspal

TCP port

TCP/IP port of the Modbus server on the local network; defaults to 502 if not specified.

TCP timeout (ms)

Time limit for establishing a client-server connection; defaults to 5000 if not specified. Connection attempt will terminate and issue a server alert if timed out.

Tag Parameters

For tag parameters not covered herein, see Tag Editor.

Modbus function

The Cloud supports the following Modbus functions (each corresponding to one of the primary tables):

Table 1. Modbus functions.

Function Description Supported data types
Coils
(read-write)
Reads or writes up to 2000 contiguous 1-bit data registers referred to as coils; does not support Swap Mode boolean (both scalars and arrays)
Discrete Inputs
(read-only)
Reads or writes up to 2000 contiguous 1-bit data registers referred to as discrete inputs; does not support Swap Mode
Holding Registers
(read-write)
Reads or writes ... 16-bit data registers referred to as holding registers; supports Swap Mode int16, int32, int64, uint16, uint32, float, double (all listed data types are supported as both scalars and arrays)
Input Registers
(read-only)
Reads ... 16-bit data registers referred to as input registers; supports Swap Mode

As shown in the table, the Modbus function of choice determines the available data type(s) and writability support. Coils and discrete inputs can both carry boolean data, with only coils being writable. These are mainly intended for on-off status transmission.

Holding and input registers can both carry a variety of data types, with only holding registers being writable. Holding registers are intended to store configuration parameters, whereas input registers are used to communicate readings from instruments.

Start address

Address of the register where the tag starts reading/writing the data. The address must be an integer ranging from 0 to 65535; the default value is 500.

Swap Mode

Enables byte swapping when using 32-bit communication. By default, the high byte comes first, followed by the low byte. 32-bit data transmission uses paired registers, or words, whereby the high word comes first, followed by the low word.1 However, some devices reverse that order; consult the device-specific data sheets to see if, and which kind of, swapping is required.

In the examples below, each line represents a single 16-bit register (a ‘word’) consisting of two space-separated, hexadecimally written bytes:

  • No swap
    32-bit data is communicated as is:
    ee 6d
    2f b2
    
  • Byte
    Byte order is reversed in each word; word order is preserved:
    6d ee
    b2 2f
    
  • Word
    Word order is reversed; byte order is preserved in each word:
    2f b2
    ee 6d
    
  • Byte and Word
    Words and bytes within each word are written in reverse order:
    b2 2f
    6d ee
    

For more details on primary tables, data swapping, and addresses, see Section 4.3 MODBUS Data model.


  1. Different sources may use different adjectives to describe byte or word seniority: high, higher, or high-order; low, lower, or low-order.