# 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.

1. Insert these functions into the spreadsheet:

   - 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.

2. Right-click an empty cell and insert the FormatOutputBuffer function into the spreadsheet.
3. From the FormatOutputBuffer dialog, click the Add button. This initiates the cell selection mode. Select the cell with the Sum function.
4. From the FormatOutputBuffer dialog, use the Data Type dropdown menu to change the Data Type to 32 bit floating point.

5. From the FormatOutputBuffer dialog, click on the Add button again. This initiates cell selection mode. Select the cell with the Count function.

6. Close the FormatOutputBuffer property sheet by clicking the OK button.

7. Right-click an empty cell and insert the WriteResultsBuffer function into the spreadsheet. Set the Buffer parameter of the WriteResultsBuffer function as a cell reference to the recently created FormatOutputBuffer function.

8. In RSLogix, go to Offline mode.

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

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

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

12. 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.
13. Place the In-Sight vision system Online.

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

15. 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.