LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Displaying indicators from a subVI into Main VI

Just need a bit of help with troubleshooting.
 
I've got a main VI which controls 2 smaller test VI's...the main VI is responsible for managing the 2 as a sort of summary page.  There are certain very relevant indicators i'd like to display on main as they display on subvi.
 
All of the indicators are visible on both pages, they just aren't sent high.  I'd like to tie one led to another in the subvi but having some issues I think with precedence.
 
I've attached a copy of the code.  The circle up top handles the popup/hiding functions for controlling the subvi's.  Works perfect until I put in the code to pass the valule from one subvi into the main.  For example when I run the vi as shown, I can get the subvi 2 to open, and close fine, but since I'm calling the subvi to light up those indicators the subvi 1 isn't loading.
 
The code to me looks like it should continually run through both while loops...and there shouldn't be a precidence bug should there?
LV7.1, LV8.5, LV2014/15/16
0 Kudos
Message 1 of 14
(3,843 Views)
Your entire loop is not visible.  Do you have some delay time inside each loop?  Without having a delay, one loop will hog all of the CPU time and try to run as fast as possible, thus starving the other loop for CPU time.  Put a delay of about 100mS in each loop.  If you need it to run faster, put 1mS (smallest amount possible).  During the delay, the CPU can process other events and threads.
- tbob

Inventor of the WORM Global
0 Kudos
Message 2 of 14
(3,824 Views)
Played around with that possibility and here is a copy of the two loops in the file...top handles window management, bottom handles indicator data forwarding.  Problem is still showing with delays built in. I've also tried switching the delay on the top one to after it runs, and the delay on the bottom one to before it runs...to make sure the file is opened from the top loop before trying to get the indicator info in the bottom loop.  Out of curiosity also put both loops into one larger loop, in a sort of nested fashion in hopes it would recognize the loop as one process, and run the two insides equally...still everything stopped working

I'm wondering if the problem might be that the file i'm opening up top (to search for tab in...the subvi), since its the same file i'm getting data from down below, if theres some kinda permissions thing going on. 

On a side not on handling loops I thought Labview was optimized for hyperthreading technology, to simulate multiple processors.  So if you have 2 loops, it runs then both pseudo simultaneously, giving time slices for each process switching back and forth till both finish respectfully when they started and in relation to size.

Anyhow more importantly, any idea what else could be causing this?  When the indicator grabbing code is in nothing will even popup anymore.

Message Edited by leachdor on 10-24-2006 01:03 PM

LV7.1, LV8.5, LV2014/15/16
Download All
0 Kudos
Message 3 of 14
(3,819 Views)
You didn't quite understand.  Put the delays in each while loop, not before or after.  In the top vi, you have three different while loops.  Each loop should have a delay in it.  In each vi, you don't need the sequence structure.  Remove it.  Leave the delay though.  The delay doesn't have to be connected to anything else, just as long as it is inside the loop.  Also, check to see if there are any loops inside the Basic vi in the lower diagram.

Message Edited by tbob on 10-24-2006 01:30 PM

- tbob

Inventor of the WORM Global
0 Kudos
Message 4 of 14
(3,794 Views)
Yep thats one of the solutions I've tried.  Just to be sure, tried it again.  No sequence structure just the delays in the while loops but still everything was non functional.  If I could I'd upload the Vi, but I've got no where to host it.

As far as "Basic" ...that is the subVI that the top While loop is opening, rather one of two.  There will be a Basic 2 that will account for the other program and be managed.  I haven't put that in there yet to grab the LED status, and it still opens and closes just fine, instantly without delay as many times as I'd like.  That indicates to me its not a problem with the loops hogging the processor since both functions are looped out exactly the same.  The only difference is the Basic being called keeps that side from opening and closing.

Also both of those basic/basic 2 (the two subvi's)...are identical in every way with the same case structures and loops in them.  Basic 2 doesn't have the delays, and still opens fine.

I don't wanna give the impression of needing the code written for me, I just don't see the problem of why my current code isn't working.
LV7.1, LV8.5, LV2014/15/16
0 Kudos
Message 5 of 14
(3,786 Views)
You can post your code by zipping all vi's and then attaching the zip file using the Browse button at the bottom of this page in the Attachment section, just like you attach a picture file.  When you call the Basic subvi,  the rest of the loop will do nothing until the Basic subvi is finished.  That is because you have wires from Basic's output to some indicators.  Execution flow is dependent on data flow.  As long as Basic is running, there is no data coming out of the subvi to the indicators, so the main loop is stalled until Basic sends its output data to the indicators.  When that happens, the rest of the main loop code executes and the loop starts over again.  This is the way Labview works, execution flow is dependent on data flow.  Any particular part of the code will start execution only when all of its inputs are present.  If you use the highlite execution tool (light bulb), you will see this happen.
- tbob

Inventor of the WORM Global
0 Kudos
Message 6 of 14
(3,760 Views)
Attached is a dumbed down version VI, that functions very much the same as the application I am trying to get working.

Control is the main control vi, popping up tabs in master and slave (one does not control the other just an easy nomenclature to keep them seperated.)  I left indicators purposefully untied on the slave VI so that you can see it still pops up just fine into the correct tab.  When using the subvi 1 (Master) it doesn't relay the indicator to the control indicator though.

This is the problem I've been working with.  Maybe its considered a type of recurssion? I'm not sure.  The delays are included in every while loop to no avail.  What do you think could be the problem?  Again, The nature of the program, I'd really not like to have the indicators invisible and just popup on the screen hopefully where they need to be.  Moreso just refering the value of one indicator to its host.

Thanks a bunch, believe me I've tried all sorts of solutions and just can't get it to run correctly!  If I want indicators, it won't popup.  If i want it to popup, no indicators.
LV7.1, LV8.5, LV2014/15/16
0 Kudos
Message 7 of 14
(3,728 Views)
One thing at a time.  First you have too many stop buttons.  One stop button should stop all.  I modified your control vi to have just one stop button.  Second, the first time you run control.vi, it will open the master and slave vi's and they will stay running because you have no provisions to stop them.  If you stop control and then run it again, the two subvi's will be inaccessible.  Again, I've modified you control to find the reference for the subvi's stop buttons and activated them when control stops.  Now the subvi's pop up to the correct tab when the proper button is pressed.  In the bottom loop, I don't know what you are doing but I deleted the call to Master because is was already opened and is running due to the code above.  If you want to get subvi indicator values, do the loop search for the indicator label and use a value property node just like you do for the tab control and like I added for the stop control.  Only instead of writing to the value property, you will read from it.
- tbob

Inventor of the WORM Global
Message 8 of 14
(3,718 Views)
tbob - would there be a reason why it wouldn't find a control when it is on the tab, but when its off the tab it works just fine?  I thought the control array would snag every control and indicator in the VI?
LV7.1, LV8.5, LV2014/15/16
0 Kudos
Message 9 of 14
(3,709 Views)
Just as a side note I've gotten it to work by sending the value from the indicator within the tab control to an indicator "off the screen" thats outside the tab control and hidden.  Then sending that value into the control vi...that seems too ineffecient though.
LV7.1, LV8.5, LV2014/15/16
0 Kudos
Message 10 of 14
(3,693 Views)