Connecting LabVIEW to an OPC Server Using Front Panel DataSocket

Publish Date: Jun 22, 2011 | 6 Ratings | 3.00 out of 5 | Print | Submit your review

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.



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

Back to Top

Bookmark & Share


Ratings

Rate this document

Answered Your Question?
Yes No

Submit