Academic Company Events NI Developer Zone Support Solutions Products & Services Contact NI MyNI

Document Type: Tutorial
NI Supported: Yes
Publish Date: Sep 6, 2006


Feedback


Yes No

Related Categories

Related Links - Developer Zone

Related Links - Products and Services

Connecting LabVIEW to an OPC Server Using Front Panel DataSocket

4 ratings | 3.00 out of 5
Print
With LabVIEW, you can connect to an OPC Server. There are several ways to connect to an OPC server, but the easiest way to use front panel DataSocket connections.

1. Create a numeric or Boolean indicator on the front panel of your VI.
2. Right-click the indicator and select Data Operations»Datasocket Connection.

3. In the DataSocket Connection dialog box, click the Browse button and select Browse Measurement data.
4. All the OPC Servers installed on your computer appear in the Browse for Item dialog box.
5. Expand the node for an OPC Server and navigate to the desired data items. The URL for the data item appears in the URL text box.
6. Click the OK button.


7. LabVIEW populates the Connect To text box with the URL for the data item you selected.
8. Select a Connection Type. Selecting Publish sets the connection to write-only, Subscribe sets the connection to read-only, and Publish and Subscribe sets the connection to read/write.
9. Click the Attach button.

[+] Enlarge Image


10. Add a While Loop and Stop button to the block diagram to make the VI run continuously. The indicator on the front panel does not have to be inside the loop.
11. Place a Wait Until Next Millisecond Multiple function in the While Loop to prevent the VI from using too much memory.


12. Run the VI. The LED on the indicator turns green and the value of the indicator updates if the connection to the OPC Server is successful.


If you want to connect to many data items in an OPC Server, use the LabVIEW Datalogging and Supervisory Control (DSC) Module. The DSC Module simplifies the task of monitoring ranges of OPC items and includes alarming and security.

Refer to the following link for more information about the DSC Module

Related Links:
Products >> LabVIEW Datalogging and Supervisory Control Module

4 ratings | 3.00 out of 5
Print

Reader Comments | Submit a comment »

 

Legal
This tutorial (this "tutorial") was developed by National Instruments ("NI"). Although technical support of this tutorial may be made available by National Instruments, the content in this tutorial may not be completely tested and verified, and NI does not guarantee its quality in any way or that NI will continue to support this content with each new revision of related products and drivers. THIS TUTORIAL IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND AND SUBJECT TO CERTAIN RESTRICTIONS AS MORE SPECIFICALLY SET FORTH IN NI.COM'S TERMS OF USE (http://ni.com/legal/termsofuse/unitedstates/us/).