LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Network-Shared Variable - read string with CVI

I need to read an NSV string with CVI.  I have been digging into accessing and writing NSV with CVI, but they are all scalar value.  What should I do with strings, clusters and arrays?

0 Kudos
Message 1 of 8
(5,631 Views)

'm an employee at National Instruments and I wanted to make sure you didn't miss the Network Variable API that is provided with LabWindows/CVI, the National Instruments C development environment. The the Network Variable API will allow you to easily communicate with the LabVIEW program over Shared Variables (http://zone.ni.com/devzone/cda/tut/p/id/4679). While reading these links, note that a Network Variable and a Shared Variable are the same thing - the different names are unfortunate...

The nice thing about the Network Variable API is that it allows easy interoperability with LabVIEW, it provides a strongly typed communication mechanism, and it provides a callback model for notification when the Network/Shared variable's properties (such as value) change.

You can obtain this API by installing LabWindows/CVI, but it is not necessary to use the LabWindows/CVI environment. The header file is available at C:\Program Files\National Instruments\CVI2010\include\cvinetv.h, and the .lib file located at C:\Program Files\National Instruments\CVI2010\extlib\msvc\cvinetv.lib can be linked in with whatever C development tools you are using.

Thomas N.
Applications Engineer
National Instruments
0 Kudos
Message 2 of 8
(5,602 Views)

Thank you so much.  Been reading other materials.  I will dive into it.

0 Kudos
Message 3 of 8
(5,600 Views)

Can you please point me towards example showing how to use read from and write to these NSV on CVI?  Thanks.

0 Kudos
Message 4 of 8
(5,581 Views)

Have you already looked at the examples that ship with CVI? You can locate them with the example finder: Help >> Find Examples... menu function, next search for "Network variables": all samples that start with "NV" demonstrate some aspect of this feature.



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 5 of 8
(5,559 Views)

I am reading NVSubscriber.c.  Can you tell me if I can use the same subscriber (defined by CNVSubscriber) to read different variables, or do I have to use one for each variable.  Thanks.

0 Kudos
Message 6 of 8
(5,510 Views)

On my PC, the NV examples are here:   C:\Users\Public\Documents\National Instruments\CVI2013\samples\networkvariable.

However, none of them seem read CNVString value.  please help.

0 Kudos
Message 7 of 8
(5,471 Views)

Try:

 

   char* strValue;

 

   if (CNVGetScalarDataValue(data, CNVString, &strValue) >= 0)
    fprintf(stdout, "%s\n", strValue);

0 Kudos
Message 8 of 8
(4,974 Views)