LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Question about various types of shared variables

Solved!
Go to solution

Hi,

 

I am trying to use shared variables to transfer data between several VIs. But I don't understand the types. Like, what is the difference between Single-process and Network-publish shared variables?  Also between Aboslute and Relative-target.

 

I already been thorugh all the post, pdfs and links. But everything seems vague, at least to me. Anyone can share insight in a simple way? I mean the absolute basics. What I am trying to do is, pass some data from Host VI to myRIO VI.

(I am not going to use global variable because I might need to transfer data over the network in future. )

 

Thanks.

0 Kudos
Message 1 of 4
(2,848 Views)

fahad80 wrote:

I already been thorugh all the post, pdfs and links. But everything seems vague, at least to me. Anyone can share insight in a simple way? I mean the absolute basics. What I am trying to do is, pass some data from Host VI to myRIO VI.

(I am not going to use global variable because I might need to transfer data over the network in future. )


A global variable won't work for passing data between targets.  If you insist on using Shared Variables, then you need the Network Published type.

 

The Single Process shared variable is basically a global variable with more overhead.

A Network Published shared variable is maintained in one target and the data is published over the network (as the name implies).  Other targets can then access that data.

 

For passing data between a computer and myRIO, I would actually recommend going with a Network Stream.  They work just like a queue, but between two networked targets.  They are a little more work for you, but they are not prone to race conditions like shared variables.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 2 of 4
(2,816 Views)

Thanks. Now I got the gist. I already explored Network Stream. I think I am gonna go for that, but in future. Right now I just need a working prototype 🙂

What about Absolute and Relative-Target? What is the difference?

0 Kudos
Message 3 of 4
(2,793 Views)
Solution
Accepted by topic author fahad80

Absolute run on the target in which you created the shared variable.  So if you created it on your myRIO, then everybody must point to the myRIO to access that variable.

 

The target-relative always connects to the variable on the target the your VI is running on.  Target-relative can only connect to the variables on the same target.  So if you put the variable on the myRIO, your host will not be able to access it.

 

So in conclusion: you want a Network Absolute Shared Varible.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 4 of 4
(2,785 Views)