Modbus TCP Communications

Modbus is a serial client/server protocol developed by Modicon for industrial automation systems. It is one of the oldest industry standard methods for the transfer of discrete and analog I/O information and register data between industrial protocol and monitoring devices.

There are multiple layers of Modbus TCP (= Modbus protocol with a TCP interface that runs on Ethernet) implementations in In-Sight, and available implementations are varied depending on the firmware versions running on the In-Sight vision systems/sensors. Refer to the table below for the detailed information on each implementation.

Supported Firmware Versions

Note: For a complete list of models and supported firmware versions, see Firmware Versions.
Modbus TCP Implementations Firmware Version
4.x.x or Earlier
Firmware Version
5.1.0 - 5.2.x
Firmware Version 5.3.0 or Later

Modbus TCP Server (5.3.0 and later)- spreadsheet and EasyBuilder1

For more information, see Modbus TCP Server Settings Dialog, Modbus TCP Factory Interface (5.3.0 or later), or Configure In-Sight Vision Systems for Modbus TCP Communications.

Not Supported Not Supported Supported

TCPDevice (client and server) - spreadsheet only

Supported Supported Supported

Direct Cell Access

Supported Not Supported Not Supported

ReadModbusBuffer and WriteModbusBuffer functions using input and output buffers (server only) - spreadsheet and EasyBuilder1

 

Supported Not Supported

Replaced by ReadUserDataBuffer and WriteResultsBuffer. For more information, see ReadUserDataBuffer or WriteResultsBuffer.

1 For more information, see Help Menu: EasyBuilder View

Modbus TCP Commands (5.3.0 or Later)

Note: For more information on this Modbus TCP implementation, see Modbus TCP Factory Interface (5.3.0 or later).
Code Description Address Space
0x01

Read Coils: This function code is used to read the state of 1 to 2000 contiguous coils in a remote device. This command would be used by a PLC to read data from the vision system/sensor.

Coil
0x05

Write Single Coil: This function code is used to write a single output coil to either ON or OFF in a remote device. This command would be used by a PLC to write data to the vision system/sensor.

Coil
0x0F

Write Multiple Coils: This function code is used to write a sequence of 1 to 1968 coils to either ON or OFF in a remote device. This command would be used by a PLC to write data to the vision system/sensor.

Coil
0x02

Read Discrete Inputs: This function is used to read the state of 1 to 2000 contiguous discrete inputs in a remote device. This command would be used by a PLC to read data from the vision system/camera.

Discrete Input
0x03

Read Holding Registers: This function is used to read the contents of a contiguous block of 1 to 125 holding registers in a remote device. This command would be used by a PLC to read data from the vision system/sensor.

Holding Register
0x10

Write Multiple Registers: This function code is used to write from 1 to 123 contiguous registers in a remote device. This command would be used by a PLC to write data to the vision system/sensor.

Holding Register
0x04

Read Input Registers: This function code is used to read from 1 to 125 contiguous input registers in a remote device. This command would be used by a PLC to read data from the vision system/sensor.

Input Register

TCP/IP Modbus Commands (4.x.x)

The following Modbus commands are supported:

Read Multiple Registers (Modbus Function Code 03)

Reads the values of multiple cells from the In-Sight spreadsheet, which are returned as 16-bit integers. Error code 02 (ILLEGAL DATA ADDRESS) is returned if any of the cells contain a non-integer value.

Note: When using the WriteModbusBuffer function, the remote client that is reading from the In-Sight vision system must use Registers 30010 – 30137.

Reference Number

 

Defines which cells to read. The high 6 bits (bits 15 through 10) of the Modbus Reference Number define the cell column (A-Z), and the low 10 bits (bits 9 through 0) define the cell row (0-399). For more information, Modbus Reference Number Examples.

Word Count

Defines how many cells will be read. For multiple cells, the values returned start at the cell defined by the Reference Number and are incremented by column. If the message requests more values than there are remaining columns in the current row, the server continues reading values from the first cell below the start row.

ClosedRead Multiple Registers Example

Example: Read Multiple Registers - reading data from 3 In-Sight spreadsheet cells (G273-G275).

When the Modbus request is received, In-Sight returns the data contained in cells G273-G275.

Byte Value (Decimal) Description

0

0

Modbus Header

1

0

2

0

3

0

4

0

5

6

Bytes to follow

6

0

Unit ID

7

3

Modbus Function Code (03 for Read Multiple Registers)

8

25

Modbus Reference Number
(In-Sight spreadsheet cell reference)

9

17

10

0

Number of Cells (Including starting cell)

11

3

Write Multiple Registers (Modbus Function Code 16)

Writes data into an In-Sight spreadsheet cell that contains an EditInt function. Error code 02 (ILLEGAL DATA ADDRESS) is returned if any of the cells do not contain an EditInt function.

Note: When using the ReadModbusBuffer function, the remote client that is writing to the In-Sight vision system must use Registers 50000 – 50127.

Reference Number

 

Defines which cells to write. The first 6 bits (bits 15 through 10) of the Modbus Reference Number define the cell column (A-Z), and the last 10 bits (bits 9 through 0) define the cell row (0-399). For more information, Modbus Reference Number Examples.

Word Count

Defines how many cells will be written into the spreadsheet. For multiple cells, the values to be written start at the cell defined by the Reference Number and are incremented by column. If the message writes more values than there are remaining columns in the current row, the server continues writing values into the first cell below the start row.

ClosedWrite Multiple Registers Example

Example: Write Multiple Registers - writing to In-Sight spreadsheet cell E9.

In the spreadsheet, create an EditInt function in cell E9 to accept the data. When the Modbus command is sent, cell E9 will then contain the value of 65.

Byte Value (Decimal) Description

0

0

Modbus Header

1

0

2

0

3

0

4

0

5

9

Bytes to follow

6

0

Unit ID

7

16

Modbus Function Code (16 for Write Multiple Registers)

8

16

Modbus Reference Number
(In-Sight spreadsheet cell reference)

9

9

10

0

Number of Cells (Including starting cell)

11

1

12

2

Byte Count

13

00

Data

14

65

Write Coil (Modbus Function Code 05)

Initiates events in the In-Sight spreadsheet. Writing a non-zero value to Coils 0 through 7 will trigger Soft Events 0 through 7 in the spreadsheet. Writing a non-zero value to Coil 8 will trigger an acquire. Error code 02 (ILLEGAL DATA ADDRESS) is returned if the coil number is not in the valid range (0 to 8).

ClosedWrite Coil Example

Example: Write Coil - Triggering an acquisition in In-Sight.

Byte Value (Decimal) Description

0

0

Modbus Header

1

0

2

0

3

0

4

0

5

6

Bytes to follow

6

0

Unit ID

7

5

Modbus Function Code (05 for Write Coil)

8

0

Coil Number*

9

8

10

255

ON. A remote device output can either be ON (255) or OFF (0).

11

0

Always Zero

* Coils are indicated using bytes 8 and 9.

Coil Number

Byte 8 Value
(Decimal)
Byte 9 Value
(Decimal)

Description

0

0

0

Specifies Soft Trigger 0

1

0

1

Specifies Soft Trigger 1

2

0

2

Specifies Soft Trigger 2

3

0

3

Specifies Soft Trigger 3

4

0

4

Specifies Soft Trigger 4

5

0

5

Specifies Soft Trigger 5

6

 

6

Specifies Soft Trigger 6

7

0

7

Specifies Soft Trigger 7

8

0

8

Acquire an image and update the spreadsheet. This option requires the AcquireImage functions Trigger argument to be set to External or Manual.

For more information, see Communicate with a Mitsubishi Automation Controller on a CC-Link Network via an Anybus X-gateway, Communicate with a Siemens PLC on a PROFIBUS Network, or Anybus X-gateway.