11-06-2013 02:19 PM
I need to read a few SV's (a few bytes every few seconds) from a LV 2012 installation over a network. The reader is on a CentOS 6 (rhel 14) box , I'd like to write a little reading routine in c/c++ which could be called from bash scripts, and am looking for c libraries for ni-psp . Why avoid LV-linux ? I've done the above in LV on another machine recently which worked fine , but the starting overhead is large in command-line and the vi takes forever to start-report-quit, and lv-as-service is a nonstarter in this application. It's possible this working vi on a separate host will end up as a UDP relay, and my final user-machine will ask this relay, but surely there is an easier way to just look at SV's on the network without another full LV installation, right ? and FWIW we've had site licenses for years, so 1.)cost the next copy is not an issue and 2.) if there are older libraries to do this that ~once~ were available, I can probably get my grubby mitts on them.
Any ideas ?
Solved! Go to Solution.
11-07-2013 01:16 PM
Hi asquit,
There is the Network Variable API that will easily allow you to communicate with LabVIEW using Shared Variables. There are header and library files with this API you can use in any C development environment. Another National Instruments employee has given a detailed answer on how to do this on a different forum. Kudos to Beerman006! I will provide a link to the original forum post as well as some more information about the Network Variable API. This should enable you to not have to install LabVIEW on the other system.
Forum link:
http://stackoverflow.com/questions/4596676/share-a-variable-between-c-and-labview
Here is a link to more information about the Network Variable API:
http://www.ni.com/white-paper/5484/en
Hope this helps!
11-07-2013 01:54 PM
Looks like the StackOverflow question and answer is Windows , and CVI -only.
Is Labwindows/CVI available for Linux ? Our distro packs for LabView contain CVI disks for Windows only, or LV for Linux.
The reason I posted the question was that a few years ago here someone found headers and libraries of LabView for linux that ~almost~ worked for some other functions in their c code, so I'd hoped that headers for Dataview functions were available somewhere in the linux LV distro and I'd just missed them.
thanks
Alex
11-08-2013 04:48 PM
Hi asquit,
I think using TCP/IP instead of trying to communicate using shared variables could be a better alternative, since TCP/IP is not based off a specific OS. TCP/IP is also more reliable since it is a connection based protocol and you will not experience data loss in your communication, which could be possible using shared variables. I will attach a link to a White Paper I found on NI.com that gives a basic overview of how to set up TCP/IP communication in LabVIEW. You will then be able to just use standard server/client C/C++ coding to communicate.
http://www.ni.com/white-paper/2710/en/
If you do decide to try this approach, there are also several examples in the LabVIEW Example Finder that you can start with.
11-14-2013 09:02 AM
TCP/IP would indeed be the most robust. Alas we're not able to get the original program do anything but write to SVs (people/history/situation, not code) , so we need a relay to convert from SV to something else downstream. Ah well, The relay machine can run the LV loop to read the SV and re-broadcast UDP or TCP/IP in perpetuity.
Thanks for the pointers
Alex
NB - The Spell Check Button - Not sure where the new spelling dictionary caches , but mine didn't know "NI" ,"psp","SV","IP" 😉