# Reading Data from the PLC

In order to get data from the In-Sight spreadsheet on an vision system running In-Sight 23.2.0 and later firmware to a Siemens PLC, you must push the data into the PROFINET stack by using the WriteResultsBuffer function. This function takes a buffer of data created by the FormatOutputBuffer function and writes the data to the inspection results area in the PROFINET Inspection Results module. The system transfers the data read from the PLC during the next update cycle.

## Workflow example

1. Create a new job in In-Sight.
2. From the Palette's Snippets tab, add these two Snippets to the spreadsheet: Acquisition > AcqCounter and Math & Logic > Random.
3. Open an AcquireImage cell and set the Trigger parameter to Continuous.
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 FormatOutputBuffer function, from the right pane, to insert it into the spreadsheet.
5. The first 4 bytes of data is automatically added to the PROFINET buffer. The first 4 bytes define the InspectionID and InspectionResultCode (as 16 bit integers), but do not appear in the FormatOutputBuffer list.
6. From the FormatOutputBuffer dialog, click on the Add button. This will initiate the cell selection mode; select the Scaled random number cell of the Random snippet.
7. From the FormatOutputBuffer dialog, click on the Add button again. This will initiate the cell selection mode; select the count cell of the AcqCounter snippet.
8. Close the FormatOutputBuffer dialog by clicking the OK button.
9. 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 WriteResultsBuffer function, from the right pane, to insert it into the spreadsheet.
10. Set the WriteResultsBuffer function's Protocol parameter to PROFINET, and the Buffer parameter as a cell reference to the buffer data structure of the recently created FormatOutputBuffer function.