Modbus TCP Factory Interface (5.3.0 or later)

This topic covers the Modbus TCP communication protocol for In-Sight vision systems/sensors running firmware version 5.3.0 and later. For a complete list of models and supported firmware versions, see Firmware Versions.

Modbus TCP Data Blocks

The defined data blocks allow you to control where the vision system is reading and writing data to and from the PLC. For easier application setup, the various control and status bits required for command functionality are grouped into contiguous blocks, which can be processed together.

Block Byte Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0

Vision

Control

0

Set

Offline

Reserved

Execute

Command

Inspection

Results

Ack

Buffer

Results

Enable

Trigger

Trigger

Enable

1 Reserved
2 Reserved

Clear

Exposure

Complete

Clear

Error

Initiate

String

Command

Set

User

Data

3

Soft

Event

7

Soft

Event

6

Soft

Event

5

Soft

Event

4

Soft

Event

3

Soft

Event

2

Soft

Event

1

Soft

Event

0

 

Vision

Status

0 Online Offline Reason

Missed

Acq

Reserved

Trigger

Ack

Trigger

Ready

1 Error

Command

Failed

Command

Completed

Command

Executing

Results

Valid

Results

Buffer

Overrun

Inspection

Completed

System

Busy

2 Reserved

Job

Pass

Exposure

Complete

String

Command

Error

String

Command

Ack

Set

User

Data

Ack

3

Soft

Event

Ack 7

Soft

Event

Ack 6

Soft

Event

Ack 5

Soft

Event

Ack 4

Soft

Event

Ack 3

Soft

Event

Ack 2

Soft

Event

Ack 1

Soft

Event

Ack 0

Block Word  

Input

 

0 Command
1 - 2000 User Data
 

Output

0 Current Job ID
1 Error Code
2 Acquisition ID
3 Inspection ID
4 Inspection Result Code
5 - 2004 Inspection Results
 

String

Command

0 String Command Length
1 - 960 String Command
 

String

Command

Result

0 Result Code
1

String Command Result Length

2 - 961 String Command Result

Vision Control Block

Byte 0

Bit Name Description
7 Set Offline

When this bit is set, the In-Sight vision system is taken Offline until the bit is cleared again.

6-5 Reserved Unused.
4 Execute Command When set, the vision system either loads the job ID specified in the Command field or executes the Job Load by Name command to load the job name given in the User Data buffer. The signal must be held high until the Command Completed signal is toggled. The falling edge of this signal (if prior to Command Complete) is interpreted as an abort request.
3 Inspection Results Ack When the Buffer Results Enable bit is set, the Inspection Results Ack bit is set by the PLC to acknowledge that it has received the Inspection Count, Inspection Result Code and Inspection Results data. The next set of inspection results is then sent to the PLC. Clearing the Inspection Results Ack bit causes the vision system to set the Results Valid bit if the buffer is not empty.
2 Buffer Results Enable When this bit is set, the Inspection Count, Inspection Result Code and Inspection Results fields are held constant until they are acknowledged by setting the Inspection Results Ack bit. Up to eight inspections are held in the In-Sight vision system's buffer. The vision system will respond to the acknowledgment by clearing the Results Valid bit. Once the Inspection Results Ack bit is cleared and there is a new set of results sent to the PLC, the Results Valid bit will no longer be cleared. If the Inspection Results Ack bit is cleared and there are no more results in the vision system's buffer that are to be sent to the PLC, the Results Valid bit remains cleared.
1 Trigger

Setting this bit triggers an acquisition when the following conditions are met:

  • The In-Sight vision system is Online.
  • The Trigger Enable bit is set.
  • The AcquireImage function's Trigger parameter is set to External, Network or Industrial Ethernet.

    Note:   The Industrial Ethernet Trigger type should be used when the trigger is coming from a PLC.
0 Trigger Enable This field is set to enable triggering via the Trigger bit. Clear this bit to disable the network triggering mechanism.

Byte 1

Bit Name Description
7-1 Reserved Unused.

Byte 2

Bit Name Description
7-4 Reserved Unused.
3 Clear Exposure Complete

While this signal is High, the Exposure Complete status will remain reset. Once this signal is set to Low, the Exposure Complete status will be set to High on the next exposure completion.

2 Clear Error

When this bit is set, it will clear the Error and Error Code signals; the Clear Error bit should be held high until the Error bit has been cleared. If an error has been queued, clearing this bit will cause the Error and Error Code signals to be set to the next queued error code.

1 Initiate String Command When this bit is set, it will read the data from the String Command field and execute the string command. Upon reading the command, the String Cmd Ack bit will be set. This bit should be held High until the vision system sets the String Cmd Ack bit to ensure that the vision system has received the command.
0 Set User Data This command is used by the PLC to indicate to the In-Sight vision system that it should transfer the User Data field into a holding buffer for consumption by the vision system.

Byte 3

Bit Name Description
7 Soft Event 7 Allows Spreadsheet soft events to be triggered. Setting any of these bits causes the associated soft event in the Spreadsheet to be triggered.
6 Soft Event 6
5 Soft Event 5
4 Soft Event 4
3 Soft Event 3
2 Soft Event 2
1 Soft Event 1
0 Soft Event 0

Vision Status Block

Byte 0

Bit Name Description
7 Online This bit is set when the In-Sight vision system is Online, and cleared when the vision system is Offline. When the vision system is Offline, examine the Offline Reason field to determine the reason.
6-4 Offline Reason This field is a 3-bit field used to identify the cause of why an In-Sight vision system is Offline:
Offline ReasonNameDescription

0

Online

The vision system is Online.

1

Programming

The vision system's job is being modified.

2

Discrete Offline

A discrete signal is holding the vision system Offline.

3

Comm. Offline

A communications protocol is holding the vision system Offline.

Note: It is possible to have multiple devices holding the In-Sight vision system Offline. In this scenario, this field will return the channel with the lowest reason code.
3 Missed Acq Set when an In-Sight vision system misses an acquisition trigger, regardless how the acquisition was triggered; cleared when an acquisition is successfully triggered.
Note: If the Trigger bit is set, but the vision system is offline, the Missed Acq and Trigger Ack bits will both be set.
2 Reserved Unused.
1 Trigger Ack Indicates when an In-Sight vision system has been triggered by the Trigger bit being set; this bit will stay set until the Trigger bit is cleared. In addition, the Acquisition ID can be latched to the rising edge of this bit.
Note: If the Trigger bit is set, but the vision system is offline, the Missed Acq and Trigger Ack bits will both be set.
0 Trigger Ready

Indicates when an In-Sight vision system can accept a new trigger via the Trigger bit. This field is true when the vision system is Online, the Trigger Enable bit is set, the AcquireImage function's Trigger parameter is set to Network, External or Industrial Ethernet, and the vision system is not currently acquiring an image.

The Industrial Ethernet Trigger type should be used when the trigger is coming from a PLC.

Byte 1

Bit Name Description
7 Error This bit is set when an error has occurred, which is defined in the Error Code field.
6 Command Failed This bit is set to 1 to indicate that Job Load has failed to run to completion. It is cleared when a new job is loaded by the PLC/HMI. If the job is changed through In-Sight Explorer, this bit does not change. This bit is always set prior to setting the Command Completed bit.
5 Command Completed When a Command completes the Command Executing bit goes low and if the Execute Command bit is still high, the Command Completed bit is set. If the Command did not successfully complete, the Command Failed bit is also set.
4 Command Executing This bit is set to 1 when Job Load is started. The Command Completed and Command Failed bits will be set prior to the falling edge of this bit.
3 Results Valid

Set when the Inspection Count, Inspection Result Code, Inspection Results and/or Job Pass bits are set. The bit is cleared when the Inspection Results Ack bit is set.

Note: If job processing is enabled to occur in overlapped mode, either the Buffer Results Enable bit should be enabled/set, or the Inspection Completed bit should be used to latch the inspection results.
2 Results Buffer Overrun

This field is set when the Buffer Results Enable bit is set and the In-Sight vision system has discarded a set of inspection results because the PLC has not acknowledged the results by setting the Inspection Results Ack bit. Up to eight inspections are held in the vision system's buffer; therefore, this bit is set when the ninth inspection is added to the buffer. The ninth inspection, and all subsequent inspections, will be dropped until there is room in the buffer (when the results have been acknowledged out). The bit is not cleared until a valid inspection occurs and a previous inspection is not overwritten.

1 Inspection Completed This bit is toggled upon the completion of an inspection. It is guaranteed to be toggled after the Inspection Count, Inspection Result Code, Inspection Results and/or Job Pass bits are sent to the PLC.
0 System Busy

Set when the vision system is running a job, loading a job or responding to user input.

Byte 2

Bit Name Description
7-5 Reserved Unused.
4 Job Pass This bit is set if the most recent job passed as configured in the Job Pass/Fail Cell Setup dialog. This bit is cleared if the job did not pass.

 

The behavior of the Job Pass bit will depend on whether or not results buffering is disabled or enabled:

Buffering Is DisabledBuffering Is Enabled
  • Set when an inspection is completed and the Job Pass/Fail cell indicates pass; otherwise it remains cleared. For more information, see Job Pass/Fail Cell Setup Dialog.
  • The Job Pass bit will be valid prior to toggling the Inspection Completed bit.
  • Set when new results are placed in the InspectionResults attribute and the Job Pass/Fail cell indicated pass for that result set; otherwise it remains cleared. The state will not change until the results are acknowledged by setting the InspectionResultsAck attribute to True, at which time the bit will be cleared.
  • The Job Pass bit will be valid prior to the Results Valid bit being set.
3 Exposure Complete This bit is set upon the completion of the In-Sight vision system's exposure period, and is reset by the Clear Exposure Complete bit. This bit will be held in a reset state if the Clear Exposure Complete signal is set to High.
2 String Command Error This bit indicates whether or not the result of the previous string command returned a failure code.
1 String Command Ack This bit is set when the vision system completes processing of a command and generates a response to the command. After the vision system has set this bit, the PLC can safely read the string command response data. The bit will be reset after the PLC clears the Initiate String Command bit. The PLC should clear the Initiate String Command bit and wait for the String Command Ack bit to return to a Low state before initiating a new command.
0 Set User Data Ack This bit is set to acknowledge completion of the Set User Data command.

Byte 3

Bit Name Description
7 Soft Event Ack 7 These bits are used to indicate that the Soft Event command was received.
6 Soft Event Ack 6
5 Soft Event Ack 5
4 Soft Event Ack 4
3 Soft Event Ack 3
2 Soft Event Ack 2
1 Soft Event Ack 1
0 Soft Event Ack 0

Output Block

Note: Data defined in the Format Output Buffer dialog will appear in the "Inspection Results" field (Word 5 - 2000) of the Output Block. For more information, see Format Input/Output Buffer Dialogs.

Word 0

Name Description
Current Job ID A 16-bit integer that denotes the ID number of the currently running job on the vision system, or 65535 if the current job does not have an ID number. This field is updated when the job is changed on the vision system, regardless of method of job change.

Word 1

Name Description
Error Code

A 16-bit numeric representation of the error that has occurred:

Code Error Description
0x0000 No Error No error occurred.
0x0100 Trigger set while disabled Occurs when the Trigger bit is set while the Trigger Enable bit is cleared and the AcquireImage function's Trigger parameter is set to External, Network or Industrial Ethernet.
0x0101 Trigger set while Offline Occurs when the Trigger bit is set while the vision system is Offline.
0x0400 Already Executing Error Occurs when the Execute Command bit is set and the Executing bit is still High.
0x0401 Job load requested while Online Occurs when a Job Load command is issued while the vision system is Online.
0x0402 Job load requested does not exist on the camera Occurs when a JobID sent in the Command field does not exist as a prefix for any job in the camera file system. For example, if you send Command = 123 and no job on the camera contains 123xxxxx.job.

Word 2

Name Description
Acquisition ID This ID increments at the beginning of an acquisition and when the Trigger Ack bit is set; can be used to synchronize an acquisition with its Inspection Results.

Word 3

Name Description
Inspection ID The acquisition ID associated with this set of results.

Word 4

Name Description
Inspection Result Code The inspection result code is defined by the Result Code parameter of the WriteResultsBuffer function. For more information, see WriteResultsBuffer.

Word 5 - 2004

Name Description
Inspection Results Inspection result data written from the spreadsheet, using the WriteResultsBuffer function. For more information, see WriteResultsBuffer.

Input Block

Note: Data defined in the Format Input Buffer dialog will appear in the "User Data" field (Word 1 - 2000) of the Input Block.

Word 0

Name Description
Command This is a 16-bit integer used to either indicate the Job ID number (0-999) of the job to load or to specify the Job Load by Name command (0x4000). The job load is executed when the Execute Command bit is set by the PLC. The Command field must be held constant between the rising edge of the Execute Command signal and the rising edge of the Command Completed signal, or the results will be indeterminate. If using the Job Load by Name command, the job name must be transferred to the User Data buffer before setting the Execute Command bit.

Word 1 - 2000

Name Description
User Data Data buffer which can be read into the spreadsheet using the ReadUserDataBuffer or ReadLatchedUserDataBuffer function. For more information, see ReadUserDataBuffer and ReadLatchedUserDataBuffer.

String Command Block

Word 0

Name Description
String Command Length The length of the Native Mode command. For more information, see Native Mode Commands.

Word 1 - 960

Name Description
String Command The Native Mode command to be processed by the vision system. For more information, see Native Mode Commands.

String Command Result Block

Word 0

Name Description
Result Code

The response code for the Native Mode command, which can be used to determine if the command was successful, or failed.

Note: Each Native Mode command returns a 1 for a successful execution, while each command has specific error codes for cases of failure. Review the individual Native Mode command topics for more information about the failure codes. For more information, see Native Mode Commands.

Word 1

Name Description
String Command Result Length The length of the Native Mode command's Response Data, in bytes.

Word 2 - 961

Name Description
String Command Result The Native Mode command's result string, an ASCII string representation of the data returned by the command.

Modbus TCP Address Map

Note:
  • The Vision Control Block, Vision Status Block, Output Block and String Command Result Block are mapped to 2 separate locations. The reason for this double-mapping is that some PLCs can only access the Holding Register portion of the address space (i.e. they only support function codes 3 and 16). The double-mapping allows those PLCs that can only access Holding Registers to successfully access all signals and data. However, PLCs that support the full function code set can access these blocks in their optimal address map locations. Please note that you should access either the optimal block location or the Holding Register location, but not both.
  • Natively, the Modbus TCP protocol uses zero based offsets for addressing. The address map diagram below shows the block locations using zero based offset. If your PLC uses Schneider form addressing, simply add the zero based offsets shown in the address map to the base Schneider address. For example, to access the "Input Block" using Schneider form addressing, you must add the "Input Block" offset (2000) to the Schneider base address for Holding Registers (400000). Therefore, in Schneider form, the Input Block starts at 402000.

Modbus TCP supports 4 distinct address spaces. There are 2 bit address space and 2 word (16-bit) address spaces.

  • Coil: Bit type address space. Output from PLC, input to vision system/sensor
  • Discrete Input: Bit type address space. Input to PLC, output from vision system/sensor
  • Holding Register: Word type address space. Both Input & Output from vision system/sensor
  • Input Register: Word type address space. Input to PLC, output from vision system/sensor
Block Name Address Space Offset Schneider Form Addressing Quantity
Vision Control Coil 0 000000 – 000031 1 – 32
  Holding Register 0 400000 – 400001 1 – 2
Vision Status Discrete Input 0 100000 – 100031 1 – 32
  Holding Register 100 400100 – 400101 1 – 2
Input Holding Register 2000 402000 – 404000 1 – 2001
Output Holding Register 7000 407000 – 409004 1 – 2005
  Input Register 2000 302000 – 304004 1 – 2005
String Command Holding Register 1000 401000 – 401999 1 – 1000
String Command Result Input Register 1000 301000 – 301999 1 – 1000
  Holding Register 6000 406000 – 406999 1 – 1000
Address (000000)
Coil Read / Write
(0x01 ,0x05, 0x0F)
Address (100000)
Discrete Input Read
(0x02)
Address (400000)
Holding Read / Write
(0x03 ,0x10)
Address (300000)
Input Register Read
(0x04)

Supported Modbus TCP Commands

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