LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Issues with passing data between VIs

Solved!
Go to solution

OK, so now I've created a queue for the processor VI. This queue was created in the main VI. I created a control from this queue and placed it in the secondary VI and am controlling my states from there.

 

When I run the program, it now tells me the refnum is invalid. I verified in the main VI that the refnum is valid, but it's not getting to the secondary.

 

This is where I was getting stuck before. How do I get the reference to the queue between the VIs without wires?

Download All
0 Kudos
Message 11 of 22
(1,711 Views)

With wires, you'd need to pass the queue wire from the main VI to the connector panel of the subVI.

 

Without wires, you will need to obtain a queue reference in the subVI using the same name you did in the main VI.  So that piece of code you have in the main VI, you would just duplicate in the subVI and wire it into the structure instead of using that queue reference control.

0 Kudos
Message 12 of 22
(1,698 Views)

Ravens Fan wrote:

With wires, you'd need to pass the queue wire from the main VI to the connector panel of the subVI.

 

Without wires, you will need to obtain a queue reference in the subVI using the same name you did in the main VI.  So that piece of code you have in the main VI, you would just duplicate in the subVI and wire it into the structure instead of using that queue reference control.


 

But then the queues wouldn't be referring to the same process, correct? I need to pass data and control states between the VIs without wires.

 

Thanks,

Jim

0 Kudos
Message 13 of 22
(1,695 Views)
Solution
Accepted by topic author phalanx02895

phalanx02895 wrote:

But then the queues wouldn't be referring to the same process, correct? I need to pass data and control states between the VIs without wires.

 

Thanks,

Jim


They will be because you will be using the same name to obtain both queue references.

 

When you use a named queue, LabVIEW will search to see if that name exists.  If it doesn't, it will create a new queue and give a reference to it.  If that name has already been used, it will give a new reference to the same queue that has already been created.

 

As Ben said, try it out!Smiley Wink

Message 14 of 22
(1,680 Views)

I did just that (try it out), and indeed that does work.

 

Thank you.

 

Now I'm having an issue with the variant-to-data. It's telling me the data type of the variant is not compatible with the data type of the input. I'm trying to send send a merged waveform (3 phases). I used a single-waveform constant wired to a merge signals with 3 terminals.

0 Kudos
Message 15 of 22
(1,669 Views)

Hi all,

 

I was taking the practice test morning!

I had this interesting question!

 

what's the best way to pass data in the same Vi?!

through wire, global or local variable!

 

My answer to this question is all three of them are the same?!  Am I right on this?!

 

just before I post this question, I have found this page

 

http://zone.ni.com/reference/en-XX/help/371361B-01/lvconcepts/vi_execution_speed/

 

in this article, it states that the  order of efficiency for passing  data within application is wire -> shift register -> global variables!

 

so, does  this mean that Wire is the best way to pass data in the same VI?

 

I know the better way for passing data through 2 different VI would be global variables!(am I right?)

 

I think I am little confused now!

 

Jay

0 Kudos
Message 16 of 22
(1,547 Views)

Hi Jay,

 

well, the referenced article says it all.

 

"I know the better way for passing data through 2 different VI would be global variables!"

My 2 cents:

- Where do you know this from?

- Please define "better"! (Faster?, more memory efficient?, less "coding real estate"?,...?)

 

just found a duplicate post...

Message Edited by GerdW on 07-21-2009 10:43 AM
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 17 of 22
(1,544 Views)

sorry about the duplicate post!  it was an accident!

 

and, was I wrong with the global variable is the better way to transfer data between different VIs?

 

can you wire 2 different VI?  by 2 different VI, I mean 2 different files!

 

so, between wire, globabl, local!

isn't the global variable the best of the three?!

0 Kudos
Message 18 of 22
(1,539 Views)

Hi Jay,

 

a global is one way to transfer data between vis. It's an easy way, but also less memory efficient & more error prone compared to other methods.

 

You still have to define "better"!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 19 of 22
(1,529 Views)

hi GerdW,

 

come to think of it, maybe my "better" was saying that it is easier!

 

but, I still don't know how to wire two vi with different files

 

Jay

0 Kudos
Message 20 of 22
(1,524 Views)