LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

passing data from a subvi to the top level with continuously running loops

Solved!
Go to solution

Turns out I am still having issues with this, they rear their ugly head again when i am trying to integrate everything. 

 

so now i have three different drivers running different aquisition tasks, and I want them to run in the background and generate events to a display VI that runs in the main program

 

I have a starthardware.vi vi that looks like this

 

starthardware.JPG

 

This runs and works as expected. 

 

I also have display vis for each one of these. for example the GPS display

 

gpsdisplay.JPG

 

During testing, can run the start hardware vi, which works, and then start the gpsdisplay.vi, and that also works fine. 

 

The problem comes when I want to start both in a main vi (this shows ampmonitordisplay and not gpsdisplay but i want all of them in there eventually)

 

mainstarthardware.JPG

 

Any ideas? It seems like a simply but fundamental misunderstanding i am having. 

Cheers,

Ben

0 Kudos
Message 11 of 27
(1,587 Views)

Hi Ben - what is the actual problem you are having when you run it all together; is there an error message of sorts; doesn't work as expected (if so, explain further)... Thanks.

0 Kudos
Message 12 of 27
(1,559 Views)

sorry i didnt explain it clearly enough. 

 

Basically what happens is becasue there are continuously running loops in starthardware.vi, the execution in the main program never "finishes" that vi to move onto the next vi to start that running. 

 

but if i start them up separately, i.e by physically clicking the run buttons on both when they are not integrated together, the events are generated properly and it all seems to work. 

 

does that make a little more sense?

0 Kudos
Message 13 of 27
(1,549 Views)

yep, that was better, thanks.

 

In the starthardware vi, do you need to have each of the 3 while loops end with an error?

 

What you have wired up here is a STOP IF TRUE condition to each while loop. No error will return a FALSE, which will mean the loop won't end until an error occurs. Is this intended?

0 Kudos
Message 14 of 27
(1,542 Views)

yeah, basically those loops are to continue indefinitely unless there is an error, as they are performing data aqcuisition - will eventually have some sort of exit functionality in there too but still just trying to get it working. 

0 Kudos
Message 15 of 27
(1,538 Views)

Bump. 

 

Any ideas?

 

Thanks in advance

0 Kudos
Message 16 of 27
(1,491 Views)

ok, the way I see it is that there may be a misunderstanding in dataflow. The hardware vi has to finish and exit before Main vi can continue onto the gps vi and other vis in the error 'chain' (dataflow). If you have those while loops running indefinitely until an error occurs, you won't be able to continue past the hardware vi until you get an error.

 

If this is not what you want it to do but still wish to continue to run hardware vi then I suggest you 'unwrap' the vi and have all those while loops in the main vi.

0 Kudos
Message 17 of 27
(1,472 Views)

so basically you can only have indefininitely running loops in the highest level vi?

 

is there another way to do it that i am missing?

0 Kudos
Message 18 of 27
(1,469 Views)

If you want the StartHardware and AmpMonitorDisplay loops to run in parallel, then you CANNOT have a data dependency (in your case, the error wire) between them. If you remove the error wire, they'll both run at the same time.

 

If you need to make sure that StartHardware has taken some action before AmpMonitorDisplay starts, but you also need StartHardware to keep running, then you should use a synchronization method such as a notifier to signal that the the required actions have occurred, and AmpMonitorDisplay should wait on the notification before continuing.

0 Kudos
Message 19 of 27
(1,458 Views)

Hi Ben - almost.

 

What is your concern with keeping the code in a sub-vi?

 

If cleanliness is an issue (and I understand this one!), I suggest implement in the Main vi two (2) while loops to run in parallel - one with the hardwarevi inside it, and the gps and other vis in the other while loop.

0 Kudos
Message 20 of 27
(1,456 Views)