Overview

Modbus or MODBUS is a client/server data communications protocol that has become a common communication protocol for communication between industrial electronic devices in a wide range of buses and network.

The Modbus protocol uses serial communication lines, Ethernet, or the Internet protocol suite as a transport layer. Modbus supports communication to and from multiple devices connected to the same cable or Ethernet network. For example, there can be a device that measures temperature and another device to measure humidity connected to the same cable, both communicating measurements to the same computer, via Modbus.

The Easy Modbus Connector allows for Modbus Devices of either traditional RTU serial communication or newer TCP ethernet communication.

Modbus data is most often read and written as "registers" which are 16-bit pieces of data. Most often, the register is either a signed or unsigned 16-bit integer values above 32768 are automatically considered as unsigned. If a 32-bit integer or floating point is required, these values are actually read as a pair of registers. The most commonly used register is called a Holding Register, and these can be read or written. The other possible type is Input Register, which is read-only.

The exceptions to registers being 16 bits are the coil and the discrete input, which are each 1 bit only. Coils can be read or written, while discrete inputs are read-only. Coils are usually associated with relay outputs.

The type of register being addressed by a Modbus request is determined by the function code. The most common codes include 3 for "read holding registers", and may read 1 or more. Function code 6 is used to write a single holding register. Function code 16 is used to write one or more holding registers.

Parameters

Name Values Description
Type TCP / RTU The Type Parameter indicates if the device to connect to uses ethernet (TCP) or RS485 (RTU)
IP IP address IP address location for the Modbus TCP device
Port Integer port number (default 502) The port number for communication.
Baud Rate 1200 / 2400 / 4800 / 9600 / 14400 / 19200, 28800 / 38400 / 57600 / 76800 /115200 (default 9600) Speed of RTU communication.
Parity Odd / Even / None Parity setting for RTU communication
Comm Name   Name of the PC comm port
Update Rate (Default 1000ms) Speed of polling of Modbus device

Supported Tag Types:

  • Bool
  • Integer
  • Decimal
  • String

For Tag addressing see the Addressing section below.

Connector Methods

Name Arguments Description
READDATA ADDRESS - address to write to (see Addressing section below for formats) Reads from the specified address or address range
WRITEDATA ADDRESS - address to write to (see Addressing section below for formats)
VALUE - value to set the address to
Writes to the specified Modbus

Addressing

The Easy Modbus connector can be used to read the following address areas - the number at the beginning of the address indicates to Industreweb what memory area to read:

0x = Coil = 00001-09999
1x = Discrete Input = 10001-19999
3x = Input Register = 30001-39999
4x = Holding Register = 40001-49999

Where a device support access to more than 10,000 of a register type the following is followed:

0x = Coil = 000001-065535
1x = Discrete Input = 100001-165535
3x = Input Register = 300001-365535
4x = Holding Register = 400001-465535

 

The address for a Tag method uses the following formatting:

Read single register

To read a single 16bit register provide a single integer address e.g. 30001

Read multiple registers

To read multiple registers use the following format, starting with the least significant and address followed by the most significant: 30001-30002