08-12-2011 05:00 PM
We have a fairly in depth VB.NET program that we have been using for years to read data from a legacy (not NI) controller. We read the data into a class and everything in the vb.net program uses the data in the class. We have just upgraded the controller in our product to a sbRIO controller with a a simple headless program on it. Basically, the program simply logs data over time, and makes current data available via a shared variable.
In my vb.net program I would like to read the arrays of doubles and strings into the class, but I can't seem to find any examples of reading the remote variables instead of local host. I need an example of something like this
Const location AsString = "//[IP Address}/variables - RT/[variable name]"
Dim bufferedReader As NetworkVariableBufferedSubscriber(OfDouble()) = New NetworkVariableBufferedSubscriber(OfDouble())(location)
bufferedReader.Connect()
bufferedReader.ReadData()
I am currently using visual studio 2008.
Thanks.
08-15-2011 05:27 PM - edited 08-15-2011 05:35 PM
Erfigge,
We dont see people using VB to control sbRIOs very often due to the added complexity/difficulty, so I have a few questions to make sure I have a good grasp of the question. What are you using to command the sbRIO? The RT .dll's that we package or standalone dlls?
Also, when you refer to remote variables, do you mean something like the shared variables you would in labview? If so, do you have distributed system manager installed?
Regards,
Kyle Mozdzyn
Applications Engineering
National Instruments
08-15-2011 05:40 PM - edited 08-15-2011 05:41 PM
I do mean shared variables. I'm not necessarily wanting to control the sbRio with vb, but I don't want to be able to read the variables. I have the distributed system manager installed but I was under the impression that pretty much only did the image for the sbrio.
As far as the DLL's, I guess I don't really understand. In visual studio I am using the "Imports NationalInstruments.NetworkVariable" at the top of my class to reference the dll's installed by national instruments.
08-16-2011 01:35 PM
Erfigge,
There is a good knowledgebase article about using network variables in measurement studio which should help you (including sample code) here:
http://zone.ni.com/devzone/cda/tut/p/id/6593
If you are just using VS without measurement studio, you will need to use an open API like datasockets.
Regards,
Kyle Mozdzyn
Applications Engineering
National Instruments