# Sending Data to the PLC

In order to get data from the In-Sight EasyBuilder spreadsheet on a vision system running In-Sight EasyBuilder 24.4.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 EasyBuilder.

2. From the Functions tab, add the following tools to the In-Sight EasyBuilder:

   - Accumulate($A$0,1,0,0)

   - Rand(A0)

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 four bytes of data is automatically added to the PROFINET buffer. The first four 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 initiates the cell selection mode. Select the Scaled random number cell of the Rand(A0) function.
7. From the FormatOutputBuffer dialog, click on the Add button again. This initiates the cell selection mode; select the count cell of the Accumulate function.
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 Protocol parameter of the WriteResultsBuffer function to PROFINET, and the Buffer parameter as a cell reference to the buffer data structure of the recently created FormatOutputBuffer function.
11. In Simatic Manager, create a new Variable Table by right-clicking on your PLC and selecting Variable Table from the Insert New Object menu.

12. Open the new table and add four items:

    Offset | Address | Display Format | Description
    --- | --- | --- | ---
    0 | PID 257 | FLOATING_POINT | Random Number
    +4 | PID 261 | DEC | Acquisition ID

    Note: The addresses assume that the Inspection Results Module is at input address 253 (the first four bytes of the module are for the Inspection ID and Inspection Result Code). If the Inspection Results Module is at a different address, apply the specified offset to the input address to set the correct address.

13. In the Simatic Manager, open Configured PLC from the PLC > Connect To menu, and then select Monitor from the Variable menu. The values displayed are identical to those displayed in the In-Sight EasyBuilder.