# Writing Data from the PLC to the Vision System

In order to send data from the Siemens PLC to the In-Sight EasyBuilder spreadsheet, the data must be pulled from the PROFINET stack by using the ReadUserDataBuffer function. ReadUserDataBuffer function takes the data format created within the FormatInputBuffer function, reads the data from the data area of the PROFINET User Data module, and formats this data into the In-Sight EasyBuilderspreadsheet. The PLC receives data at every update cycle.

## Workflow example

1. Open the AcquireImage cell and set the Trigger parameter to Continuous.
2. Right-click an empty cell and select Insert Function to open the Insert Function dialog. From the left pane, click the Input/Output category, then double-click the FormatInputBuffer function, from the right pane, to insert it into the spreadsheet.

3. From the FormatInputBuffer dialog, click the Add button and add a 32-bit float and a 32-bit integer to the list.

4. Close the FormatInputBuffer 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, click the Input/Output category, then double-click the ReadUserDataBuffer function from the right pane, to insert it into the spreadsheet .
6. Set the Protocol parameter of the ReadUserDataBuffer function to PROFINET, and the Buffer parameter as a cell reference to the recently created Buffer data structure of the FormatInputBuffer function.
7. Add the GetBufferData function to the spreadsheet based on the fields you specified in the FormatInputBuffer function.
8. Set the In-Sight vision system Online.
9. In Simatic Manager, create a new Variable Table by right-clicking on your PLC and selecting Variable Table from the Insert New Object menu.

10. Open the new table and add four items, two for the sent user data, and two for SetUserData and SetUserDataAck:

    Offset | Address | Display Format
    --- | --- | ---
    0 | PID 257 | FLOATING_POINT
    +4 | PID 261 | DEC
    | Q1.2 | BOOL
    | I4.7 | BOOL

    Note: The addresses assume that the User Data Module is at output address 257. If the User Data Module is at a different address, apply the specified offset to the output address to set the correct address.

11. In the Simatic Manager, click on the PLC > Connect To > Configured PLC menu.

12. Enter values for the four items added to the Variable Table and then select Activate Modify Values from the Variable menu.

13. After entering the values, set the SetUserData bit, wait for the SetUserDataAck bit to be set, and then clear the SetUserData bit.

14. The values in the In-Sight EasyBuilder change to the entered values.