Connecting LabVIEW to an OPC Server through a DataSocket Connection
You can use LabVIEW as an OPC client by connecting to an OPC server through a DataSocket connection. This document shows how to use an example VI that connects to the Lookout Protocol Drivers server to read a register value from a Modbus device. You can use this procedure to connect VIs to devices on any OPC server, such as FieldPoint, NI-DAQ, RSLinx, or Applicom.
Make sure you have LabVIEW 6.0 or later and Lookout Protocol Drivers 4.5 or later installed on your computer before completing this procedure.
Complete the following steps to read a PLC register value from a Modbus device on the Lookout Protocol Drivers OPC server to a VI using a DataSocket connection.
- Open the opc.llb in labview\examples\comm.
- Open the Multiple OPC Items Monitor VI. This VI uses DataSocket to connect to an OPC server. You can press the <Ctrl-E> keys to display the block diagram and examine how it works.
- On the front panel, toggle the horizontal switch to Select Items and set Number of items to select to 1, so you can select a single register value.

- Run the VI. The Select Item 1 dialog box appears and displays all the OPC servers available to your system. Navigate to National Instruments.OPCLookoutDrivers»Lookout Protocol Drivers»Modbus1 and select register 40001-49999. Click the OK button.

- If your connection is successful, the waveform chart displays the B:0 register value.

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/).
