# Send Data To an In-Sight Vision System

To send data from the ControlLogix PLC to the spreadsheet, the data must be pulled from the EtherNet/IP stack by using the ReadUserDataBuffer function. This function takes the data format created within the FormatInputBuffer function and reads the data from the data area of the EtherNet/IP Output Assembly (output from the network), and formats this data into the spreadsheet. This data is received from the PLC every RPI cycle; the corresponding spreadsheet data is updated only when the spreadsheet executes.

1. Open the AcquireImage cell (A0) and set the Trigger parameter to Continuous.
2. Right-click an empty cell and insert the FormatInputBuffer function into the spreadsheet.

3. From the FormatInputBuffer dialog, click on the Add button and add two 32-bit floating point to the list.

4. Close the FormatInputBuffer by clicking the OK button.
5. Right-click an empty cell and insert the ReadUserDataBuffer function into the spreadsheet. Set the ReadUserDataBuffer function's Buffer parameter as a cell reference to the just created FormatInputBuffer function.

6. Right-click an empty cell and insert the GetBufferData function into the spreadsheet. Set the GetBufferData function's ReadBuffer parameter as a cell reference to the just created ReadUserDataBuffer function. The GetBufferData function's index parameter determines which data value in the FormatInputBuffer to reference. For example, if you set the index parameter to 0, the first floating-point data value in the FormatInputBuffer will be returned. If you set the index parameter to 1, the second floating-point data value in the FormatInputBuffer will be returned.

7. In RSLogix, go into Offline mode.

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

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

10. Next, add a new tag to the project's Controller Tags, using the user-defined data type, as shown in the example below.

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

12. Place the In-Sight vision system Online.

13. In RSLogix, click the drop-down arrow on the Offline button, and select Download.

14. Open the Controller Tags dialog and change the values of the InSight_Top_Output.Data1 and InSight_Top_Output.Data2. After changing the InSight_Top_Out.Data1 and InSight_Top_Out.Data2 values in the PLC, set the SetUserData bit in the PLC and wait for the SetUserDataAck bit to be set and then clear the SetUserData bit. Once the ReadUserDataBuffer cell runs in the spreadsheet, the values will be updated in the spreadsheet.