# Configure In-Sight vision system for Modbus TCP Communications

This topic describes how to connect an In-Sight vision system to a PLC A Programmable Logic Controller is a ruggedized computer that you can use for automating processes or even an entire production line. using Modbus TCP communications.

## Establish Modbus TCP Communications

Before Modbus TCP communications can be established with an In-Sight vision system, the vision system must be configured to enable Modbus TCP Server, using the Industrial Ethernet utility of the vision system. Once enabled, the Modbus TCP Server Settings dialog is used to configure the connection to PLC.

1. Open In-Sight Vision Suite and select the vision system from the device list.
2. Open the Industrial Ethernet utility in the list of utilities.
3. In the Industrial Ethernet Configuration dialog, select Modbus TCP Server from the Select Protocol dropdown menu.
4. Configure the Max Connections and Idle Timeout controls.
5. Restart the In-Sight vision system to apply the changes, enabling the Modbus TCP Server service upon completion of the power cycle.

## Configure the In-Sight Vision System to Receive Image Acquisition Triggers

It is possible to trigger the vision system from the PLC to acquire images. Setting the Trigger parameter in the AcquireImage function Functions are tools that are available in Spreadsheet for processing and analyzing acquisitions or other results. You can add functions to your Spreadsheet job to create tool chains and produce results for specific applications. to Industrial Ethernet enables the PLC to trigger the vision system when Modbus TCP Server communication is enabled.

1. In Spreadsheet, open the property sheet for the AcquireImage function.
2. Set the Trigger parameter to Industrial Ethernet.
3. Place the In-Sight vision system Online.

4. An In-Sight vision system can be triggered by directly manipulating the Trigger Enable and Trigger bits in the Control block.

   Note: For detailed information about mapping the In-Sight vision system inputs and outputs into process memory, see Modbus TCP Factory Interface.

## Get Data From an In-Sight Vision System

In order to get data from the In-Sight 3D Spreadsheet to a PLC, the data must be pushed into the Modbus TCP stack by using the WriteResultsBuffer function. This function takes a buffer of data created by the FormatOutputBuffer function and writes the data to the configured Modbus TCP stack. The PLC can then read the data with Modbus TCP read commands.

1. In Spreadsheet, right-click an empty cell and select Insert Function to open the Insert Function dialog. From the left pane, select the Input/Output category, then double-click the FormatOutputBuffer function in the right pane to insert it into Spreadsheet.
2. In the FormatOutputBuffer dialog, click on the Add button. The Select Output Data dialog opens, where you can select the data item to output.
3. If there is additional data to be sent, repeat the previous step.
4. Close the FormatOutputBuffer dialog by clicking the OK button.
5. Right-click an empty cell and select Insert Function to open the Insert Function dialog. From the left pane, select the Input/Output category, then double-click the WriteResultsBuffer function in the right pane to insert it into Spreadsheet.
6. Set the Protocol parameter of the WriteResultsBuffer function to 3 = Modbus TCP Server, and the Buffer parameter as a cell reference to the Buffer data structure of the recently created FormatOutputBuffer function.
7. Optionally, set the Result Code parameter as a cell reference to a cell in the spreadsheet to retrieve the result code with the inspection results.

## Send Data to an In-Sight Vision System

In order to send data from the PLC to the In-Sight 3D Spreadsheet, the data must be pulled from the Modbus TCP stack by using the ReadUserDataBuffer function. This function takes the data format created within the FormatInputBuffer function, reads the data received from the PLC, and formats this data into Spreadsheet.

Note: In order to trigger the In-Sight vision system to read the user data from the PLC, the Set User Data bit in the Control block must be set high from the PLC.

1. In Spreadsheet, right-click an empty cell and select Insert Function to open the Insert Function dialog. From the left pane, select the Input/Output category, then double-click the FormatInputBuffer function in the right pane to insert it into Spreadsheet.
2. From the FormatInputBuffer dialog, click on the Add button and add the data items desired to the list.
3. Close the FormatInputBuffer dialog by clicking the OK button.
4. Right-click an empty cell and select Insert Function to open the Insert Function dialog. From the left pane, click on the Input/Output category, then double-click the ReadUserDataBuffer function in the right pane to insert it into Spreadsheet .
5. Set the Buffer parameter of the ReadUserDataBuffer as a cell reference to the Buffer data structure of the recently created FormatInputBuffer function.

6. Set the Protocol parameter of the ReadUserDataBuffer function to 3 = Modbus TCP Server.

7. Once the functions are implemented, place the In-Sight vision system Online to test the configuration.