# Get Data from an In-Sight Vision System

To get data from an In-Sight vision system to a ControlLogix PLC A Programmable Logic Controller is a ruggedized computer that you can use for automating processes or even an entire production line., the data must be pushed into the EtherNet/IP stack by using the WriteResultsBuffer 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..

This function takes a buffer of data created by the FormatOutputBuffer function and writes it to the data area in the EtherNet/IP Input Assembly of the In-Sight vision system when the event configured in the WriteResultsBuffer executes. This data is then transferred to the PLC during the next RPI cycle after the execution of the spreadsheet completes.

When multiple inspection results need to be sent to the PLC, the results can be buffered in the vision system and sent over individually by using the ResultsValid and InspectionResultsAck bits in the PLC. To enable the buffering of inspection results, set the BufferResultsEnable bit in the control block.

Tip: Use the ResultsValid bit to decide when to read data to prevent subtle intermittent timing issues in your PLC logic that can arise from this setup, as the ResultsValid bit only becomes high when data are ready to read, and not before.

To test the connection to the PLC by sending data to the PLC:

1. Click on the Inspect application Step and insert a Math tool.

2. Insert the following functions into the spreadsheet. You can use the Acquired keyword as the Event parameter for the Count and Rand functions.

   - Count

   - Rand

   - EditInt

   - Sum

   Set the parameters of the Sum function as a cell reference to the sum of the value returned by Rand and EditInt functions.

3. Click on the Communication application step, and under Industrial Ethernet, select Ethernet/IP as the Target Protocol, then click on Format Data.

4. In the Outputs section, add the cell references of the Sum and Count functions in the Math tool by clicking +.

   Ensure that the Data Type for both cell references is 32 bit floating point.

5. In RSLogix, go to Offline mode.

6. Within RSLogix, right-click on the Data Types > User-Defined folder and select New Data Type from the menu.

7. Give the new data type a descriptive name and add two floating point values to the Members list.

8. Next, add a new tag to the Controller Tags of the project, using the user-defined data type.

9. Add a COP instruction to the MainRoutine ladder logic program.

   Note: The Length field is the number of the input structures that are copied to the Dest field in the COP.
10. Place the In-Sight vision system Online.

11. In RSLogix, click the dropdown arrow on the Offline button, and select Download.

12. After this program has been downloaded to the ControlLogix PLC, the data from the Random and Acquisition Acquisition is the process or result of the vision system acquiring a new image. Counter spreadsheet cells now appears in the InSight_Top_Input tag in the floating point format.