Example Code

CVI and LabVIEW Network Published Shared Variables

Products and Environment

This section reflects the products and operating system used to create the example.

To download NI software, including the products shown below, visit ni.com/downloads.

    Software

  • LabWindows/CVI

Code and Documents

Attachment

Description

 

The attached files contain a LabVIEW 8.6 project and a CVI 8.5 project that uses Networked Published Shared Variables to communicate with each other. Please review the following documents for background on Shared Variables:

 

Network Variable Technical Overview

Comparison of LabWindows/CVI Network Variable Connection Types

Using the LabVIEW Shared Variable

 

To run this example please conduct the following steps in order:

1. Open the lv_cvi_test.lvproj with LabVIEW 8.6 or above.

2. Open and run the lv_cvi_test.vi, this will deploy the in_out_lib.lvlib.

3. Once the lv_cvi_test.vi is running, open the NVSubscriberWriter.prj using LabWindows/CVI 8.5 or above.

4. You can click on the green arrow (Debug Project) and the project will start running.

 

Once the CVI program is running, click on the Browse button and navigate to the computer that is hosting the in_out_lib.lvlib. After you expand the in_out_lib.lvlib tree, select LabVIEW_Input for the network shared variable that will write to the chart and select CVI_Output for the shared variable that will write to the CVI_Output indicator on the lv_cvi_test.vi's front panel. Increment and decrement the controls on both the CVI user interface and the LabVIEW front panel and notice how each affect the other. Click on the X button to close the CVI program and click on the Stop button to stop the LabVIEW program.

 

LabVIEW Front Panel:

frontpanel.JPG

 

CVI User Interface:

 

cviuserinterface.JPG

 

Joshua B.
National Instruments

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

Comments
BenSpd
Member
Member
on

I have tried running this example, but when I push the green arrow (Debug Project) I get "Unable to create file "C:\...\cvi\cvibuild.NVSubscribersubscriber_dbg.exe" (Badly formed pathname)"

I am using LabWindows/CVI 2009 and LabView 2009.

MilanR
Active Participant
Active Participant
on

I received the same error as BenSpd but was able to run the project in LabVIEW 2011 SP1 and CVI 2010 by deleting the workspace (.cws) and project files (.prj) and creating new ones from scratch and adding the .c, .h, and .uir


Milan