01-11-2015 07:38 PM
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
This runs and works as expected.
I also have display vis for each one of these. for example the GPS display
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)
Any ideas? It seems like a simply but fundamental misunderstanding i am having.
Cheers,
Ben
01-11-2015 09:55 PM
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.
01-11-2015 10:20 PM
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?
01-11-2015 11:24 PM
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?
01-11-2015 11:28 PM
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.
01-13-2015 04:50 PM
Bump.
Any ideas?
Thanks in advance
01-13-2015 06:49 PM
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.
01-13-2015 06:57 PM
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?
01-13-2015 07:31 PM
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.
01-13-2015 07:36 PM
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.