LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Can you use Use create user event, generate user event, etc. to pass data from one VI to another VI, kind of like global variable? Is it possible?

Solved!
Go to solution
Solution
Accepted by topic author GRCK5000

@GRCK5000 wrote:

Most programmers advise not to pass data between two or more VIs using global variables. I had a post some time ago and I asked if it was possible to pass data between two VIs and @mcDuff said that it was possible and even provided great examples. In these examples, events are being used to pass data between two loops, more like producer-consumer architecture, but not between VIs. 

I have attached a VI called sender and I would like to pass string "hello" to receiver.vi

 

You could use a named Queue, although caution is needed when using them.

The following example will work, if and only if, your receiver VI is started before the sender.

 

mcduff_0-1722624674973.png

 

Download All
Message 11 of 14
(176 Views)

@mcduff wrote:

 

 

You could use a named Queue, although caution is needed when using them.

 

 


I use them all the time - did you know, you can spawn up to 1Billion named queues on  2014 intel I7 @ 12 gb ram before running in any problems?!  (labview reports a warning or error too many queues, if I remember correctly)

 

and you are meant to close them, by "close queue"

 

probably, no good advice...

Message 12 of 14
(165 Views)

@alexderjuengere wrote:

@mcduff wrote:

 

 

You could use a named Queue, although caution is needed when using them.

 

 


I use them all the time - did you know, you can spawn up to 1Billion named queues on  2014 intel I7 @ 12 gb ram before running in any problems?!  (labview reports a warning or error too many queues, if I remember correctly)

 

probably, no good advice...


Named Queues, Bytes at Port, Global Variables, etc. are like religion and politics on this forum; don't want to get into a flame war, thus a warning. 🙂 

 

PS I use them too.

 

 

0 Kudos
Message 13 of 14
(160 Views)

Thanks McDuff! I will definitely go with queue, just turn the two codes into subVIs. Boom!

0 Kudos
Message 14 of 14
(144 Views)