02-06-2015 12:58 PM - edited 02-06-2015 12:58 PM
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?
02-09-2015 01:54 PM
'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.
02-09-2015 01:55 PM
Thank you so much. Been reading other materials. I will dive into it.
02-10-2015 04:02 PM
Can you please point me towards example showing how to use read from and write to these NSV on CVI? Thanks.
02-12-2015 04:00 AM
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.
02-16-2015 01:23 PM
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.
02-19-2015 01:57 PM
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.
08-06-2015 06:36 PM
Try:
char* strValue;
if (CNVGetScalarDataValue(data, CNVString, &strValue) >= 0)
fprintf(stdout, "%s\n", strValue);