2.1 Creating a Simple VI to Save Data to Origin

In this tutorial, you will create a VI to send data from LabVIEW to an Origin column of an Origin worksheet.

1. Run Origin. If Origin is already running, start a new project.

2. Run LabVIEW and new a blank VI.

3. Activate the Block Diagram window and right-click inside the window.

4. From the Functions palette, choose All Functions, then User Libraries, then paletteMenu.

5. Choose OA_ConnectToOrigin(App) VI OA ConnectToOrigin App.jpg and place it in the window.

6. Right-click in the window again, and select OA_FindAddWorksheet VI OA FindAddWks.jpg from the same palette as in the previous step.

7. Wire the Origin.IOApplication and Error IO connectors to the two VIs. Make sure to choose output side connectors for the OA_ConnectToOrigin(App) VI and input side connectors for the OA_FindAddWorksheet VI.

8. Add a string constant and assign to it the string [Book1]Sheet2.

9. Wire the string constant to the Worksheet Name connector of OA_FindAddWorksheet VI. (Hint: You can click on any Origin VI you place in the window, then go to the Help menu and select Show Context Help. This will open the contextual help window with specifics on the connectors to the VI).

10. Add an OA_GetColumn VI OA GetColumn.jpg from the Origin VI palette, and wire the Origin.Worksheet and Error IO connectors to the corresponding connectors of the OA_FindAddWorksheet VI.

11. Add a numeric constant and set it to 0, and wire it to the Column Name/Index connector of OA_GetColumn VI.

12. Add an OA_Col-SetData VI OA Col-SetData.jpg from the Origin VI palette, and wire the Origin.Column and Error IO connectors to the corresponding connectors of the OA_GetColumn VI.

13. Add a numeric constant and set it to 0, and wire it to the nOffset connector of OA_Col-SetData VI.

14. Add an array constant and set it as you want, and wire it to the data connector of OA_Col-SetData VI.

15. When the wiring is completed, your Block Diagram window should look like this:

Tutorial1.jpg

16. Click the Run button to send the data to Origin. You should see the data in the [Book1]Sheet2 worksheet. Try changing the Column number controls to place data in a different location in the worksheet.