From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Getting a list shared variable references

Solved!
Go to solution

I'm working on a data acquisition project that's going to be using the SVE. It's really my first excursion into the SVE, and I've hit a stumbling block. 

 

I was going to use a for loop to dole out the acquired waveforms to their appropriate variables (DAQmx Read Nsamples, Nchannels, 1D of DBL waveforms, each waveform get's it's own variable.) But the 'Get Shared Variable List' returns a list of the variable names, but the 'Write Variable' requires a variable reference. How do I go from one to the other? 

 

I've posted a snippet of what I have so far. 

 

-Ian

0 Kudos
Message 1 of 5
(3,535 Views)
Solution
Accepted by iyeager

It seems like you are dealing with two different classes of variables.  The one function is coming from the DSC palette and returns something that looks like an array of DSC tags. 

The purple wire says it is a network variable (BV tag), but hook up a property node to that and the class is SharedVariable I/O.

 

Your other function is coming out of the Data Communication/Shared Variable palette and just says it is a variable.

 

I can't claim for sure this would work as I have no way of testing it.  But if you use the name property node for the DSC tag, and use that to open a shared variable reference, the wires all connect without errors.

 

0 Kudos
Message 2 of 5
(3,531 Views)

That was closer, but that only returns the name, without the parent or process, so it was a little incomplete still. But with some string work, I got it figured out. Decided to use just the communication .vi's too, rather than mixing and matching from the palettes. 

 

snippet.png

 

Thanks Raven, you got me that step though. 

 

-IAn

0 Kudos
Message 3 of 5
(3,521 Views)

Or, for those of us with the DSC module, there's this...

 

snippet.png

 

I guess I should have opened my eyes from the start and just popped in the handy 'Shared Variable to String' before. Smiley Frustrated

 

Good to know both ways I guess.

 

-Ian

0 Kudos
Message 4 of 5
(3,519 Views)

Here's a slightly different twist I've used that could be scaled up to handle an array of SVs.

 

In my case the SVE is hosted on a cRIO.  I needed to be able to adapt to different IP address for the cRIO and changes to the name of the SV lib.  These settings are stored in a local .ini.   I use an action engine to verify/open the connection and store the SV refnum in a shift register.  The other states of the AE are simple read and write.

 

0 Kudos
Message 5 of 5
(3,513 Views)