LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Passing queue reference to a subvi using queue message handler

Hi,

    I want to pass a queue reference to a subvi.I created two vi s.First vi  continuously generate the value and add that value to a queue.Simultaneously Second vi needs to  display this value.But some problem in passing the queue reference.Please help..

Download All
0 Kudos
Message 1 of 12
(3,999 Views)

hi there,

i'm still running on an older labview version, so i can't open your VIs,

but depending on the way you start your subvis, you can either have an input terminal for the queue-reference, or you could store the referenc(es) in a global variable,

and read that inside the subvis.

 

regards


If Tetris has taught me anything, it's errors pile up and accomplishments disappear.
Message 2 of 12
(3,993 Views)

Hi LHa,

 

unfortunately a lot subVIs are missing from your upload. Can you put the whole project into a ZIP file?

 

But some problem in passing the queue reference.

Which problems? The queue is passed to your subVI…

 

On your "frontpanel.vi": Why are there several tunnels for the same value? One tunnel is enough…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 3 of 12
(3,986 Views)

Hi,

     Here i am attaching the whole project into a ZIP file.

0 Kudos
Message 4 of 12
(3,968 Views)

Hi

  When click on the OK button in Front Panel.vi,an error occur as in the attached image.When these all are in one vi,it is working.

0 Kudos
Message 5 of 12
(3,965 Views)

Hi LHa,

 

and what exactly is your problem? You didn't describe the symptoms or errors you got…

Edit: now I saw your next message…

 

Why do you create new messages queues in your "frontpanel" subVI? Why don't you wire the queue reference from your main VI?

And why don't you call that "frontpanel" subVI inside of your mainVI?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 6 of 12
(3,962 Views)

Hi

    Main.vi is working properly.My requirement is Event Handling Loop and Message Handling Loop should be in separate vi s.That  is why I created Frontpanel.vi and Savingto_table.vi.On a button click in Frontpanel.vi  ,it generates random numbers and Savingto_table.vi needs to display it.But on  button click in Frontpanel.vi, error occurs as in the attached image. When Event Handling Loop and Message Handling Loop are in same vi (i.e , in Main.vi)  it is working.

0 Kudos
Message 7 of 12
(3,935 Views)

You'll get that error when your variant data isn't compatible with the type your converting it to. So your variant isn't a float\numeric. Put a probe on that variant, and see what you are trying to convert to double.

 

Could be an empty variant, that you'll get when the queue returns with a time out.

Message 8 of 12
(3,924 Views)

You could just create references to the same queue in both subVIs; by obtaining queues and wiring exactly equal name strings to the queue name input of "obtain queue" in both VIs.

 

Just remember that you need to call release queue as many times as you called obtain queue when you shut down.

Best regards,

Jarle Ekanger, MSc, PhD, CLD
Flow Design Bureau AS

- "The resistance of wires in LabVIEW is not dependent on their length."
0 Kudos
Message 9 of 12
(3,918 Views)

@JarleEkanger wrote:

You could just create references to the same queue in both subVIs; by obtaining queues and wiring exactly equal name strings to the queue name input of "obtain queue" in both VIs.


I avoid named queues when possible (always, give or take a few corner cases). String references can be terrible to track. They make the queue globally accessible, and usually that doesn't do much good for modularization (e.g. it encourages tight coupling). It works, but when applications grow (and grow), sooner or later you'll regret it.

0 Kudos
Message 10 of 12
(3,912 Views)