LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Passing two Datatypes Via Queue to subvi

Solved!
Go to solution

Hi,

 

I am currently trying to get two queues to pass data over, one via strings and one via numeric. I have it seperated into to VIs where the operator has it split between two monitors. I am a fairly new labVIEW user and keep banging my head against the wall. I've seen this done with one queue and wondering the strategy to get two datatypes over to the other VI. 

 

Attached is a screenshot of my current block diagram. 

 

Thanks!

0 Kudos
Message 1 of 7
(1,235 Views)

Hi sckleymann,

 

I am a fairly new labVIEW user and keep banging my head against the wall.

When you are new to LabVIEW you should take the FREE online resources offered for beginners on NI's website!

(Banging the head against a wall is unhealthy! Smiley Very Happy)

 

I've seen this done with one queue and wondering the strategy to get two datatypes over to the other VI. 

A queue can only handle one datatype, so you have the following options:

- use two queue, one for each datatype

- use a queue to transport a cluster of [string, DBL] and use whatever item is needed

- use a queue to transport a cluster of [enum, variant]. Use the enum to provide information of the variant's content and to convert the variant to data correctly in your subVI!

There are example VIs showing how to use queues…

 

Attached is a screenshot of my current block diagram.

Attaching VIs instead would be so much better…

Best regards,
GerdW
CLAD expired, using 2009SP1 + LV2011SP1 + LV2017 (+LV2018 sometimes) on Win7+cRIO
Kudos are welcome Smiley Wink

Message 2 of 7
(1,228 Views)

Hi GerdW,

 

When you are new to LabVIEW you should take the FREE online resources offered for beginners on NI's website!

Thanks for the response. I'll check them out. These forums have been helpful as well with searching previous posts.

 

Attaching VIs instead would be so much better…

I've put together a quick example of two queues for each datatype, but cannot get them to wire correctly? 

The type of the source is different than the Queue RefNum? Am I missing something obvious? 

 

Thanks

0 Kudos
Message 3 of 7
(1,214 Views)

Hi sckleymann,

 

unfortunately I'm stuck with LV2014 here so I cannot open your VIs. Mind to do a "save for previous" before attaching?

 

The type of the source is different than the Queue RefNum? Am I missing something obvious?

Yes: Each queue has a datatype and the wires must match them.

When you create a queue in your VI you can right-click it's wire and choose "create -> control". Move this control into your subVI and use it as input of this subVI: now it uses the same datatype as in your main VI!

Best regards,
GerdW
CLAD expired, using 2009SP1 + LV2011SP1 + LV2017 (+LV2018 sometimes) on Win7+cRIO
Kudos are welcome Smiley Wink

0 Kudos
Message 4 of 7
(1,206 Views)

Hi GerdW,

 

Apologies, I have saved them for version 14. It's actually in the main VI where I call the subVI, it has the Queue refNum error. Guessing it's a rookie mistake, I am basing my code off examples I've seen here and I really appreciate you helping me along.

 

Thanks

0 Kudos
Message 5 of 7
(1,194 Views)
Solution
Accepted by topic author sckleymann

Hi sckleymann,

 

in your case the solution is even simpler: when you want to use two queues you need to change the connector pane to have also two queue ref inputs in your subVI!

Read the LabVIEW help to learn how to work with the "connector pane"!

 

(This is pretty basic LabVIEW stuff and you learn this in those FREE beginner tutorials. Did you take them as suggested before?)

Best regards,
GerdW
CLAD expired, using 2009SP1 + LV2011SP1 + LV2017 (+LV2018 sometimes) on Win7+cRIO
Kudos are welcome Smiley Wink

Message 6 of 7
(1,183 Views)

Yeah, that took me way too long to realize. Thanks for all the help and your time. I learned a few concepts along the way and will do some more reading.

0 Kudos
Message 7 of 7
(1,163 Views)