Example Code

OPC Client - Read/Write Numeric Item Exmple

Code and Documents

Attachment

Download All

Overview
This example VI shows how to use event structural to trigger code to write to an OPC Item while still being able to read from it.

 


Description
This example VI shows how you can use events to trigger your code to write to an OPC Item while still being able to read from it. The VI has been using with the 'National Instruments.OPCDemo>> NI OPC Demo Server>>Analog Items>>Integers>>VT_I2:1.0..1000.0' item. The program will read from the value every 100ms (the event structure timeout case) but will write the value in the Numeric control when you press the 'Set Numeric Item' button

 


Requirements

  • LabVIEW 2012 (or compatible)


Steps to Implement or Execute Code

  1. Download the attached folder to your computer
  2. Open the VI "OPC Client 2012 NIVerified.vi"
  3. Run the program
  4. Select an OPC item from the pop tree menu
  5. Press the "Set Numeric Item Button" to write the value in the "Set Value Controller"

 

Additional Information or References
VI Snippet

 undefined

 

 **This document has been updated to meet the current required format for the NI Code Exchange.**

 

James W
Controls Systems Engineer
STFC

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.

Comments
CatLabMan
Member
Member
on

Where's that Browse OPC sub VI ?

JTG_Wilson
Member
Member
on

Hi MartinP,

I wondered who'd be the first to spot that obviously deliberate mistake (I didn't just forget to include it in the attached example, honest) and it's been 4 years before someone asked. I have no idea what was in the Browse OPC sub VI at this point but the program works fine by just using the 'DataSocket select URL.vi.

I've updated the attached VI and VI snippet so I hope this helps and thanks for letting me know about my mistake.

Regards,

James

James W
Controls Systems Engineer
STFC