LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Transferring data out of while loop breaks when using notifier to stop state machine and while loop

I have been playing around with using more subVI to string code together.  I'm having a problem with a countdown timer Transferring out data to the front panel of the testing.vi.  If I use a stop icon to stop the loop the data transfers as I expected.  But when I use a notifier to stop both loops at the same time the data does not transfer to the front panel of the testing.vi.  Is there an easy way to fix this problem, or do I have a more fundamental problem with choosing a poor design to complete my task?

 

Thank you

Danny
Download All
0 Kudos
Message 1 of 6
(4,580 Views)

Hey Danny,

 

I don't really understand the architecture of your program.  Is there a reason for using two parallel loops?  It looks like they are not entirely necessary; why not just wrap everything into a single loop and there is no need for the notifier?

 

Matt

 

 

0 Kudos
Message 2 of 6
(4,564 Views)

I may have a similar problem.  In the past (LV 6) I used occurrences to coordinate a high-speed while loop (acquiring data from a DAQ card, performing a moving average filter, load averages into a global array) with a slower-speed while loop that inserts the global data into pre-allocated arrays, displays them, and manages slow-speed analog output operations.

 

Under LV 7 ( I know, I know...dated. But hey) this breaks.  The slower loop runs way too fast, and somehow the initialization of the fast loop is unpredictable.  I need to learn how to either implement notifiers or timed loops, and need some guidance.

 

Sounds a bit like Danny's problem...

 

Paul D 

0 Kudos
Message 3 of 6
(4,532 Views)

Hey Paul,

 

I understand the need in general for parallel loops (I run them myself on most my applications because I am usually running fairly high data rates), but in Danny's case the need is not immediately clear to me and I suspect I am missing something (i.e. the program is probably not complete).  

 

That being said, I am still not fully understanding the problem: is the data transferred the data associated with the shared variable?  If that is the case, it is unclear how it could not possibly be transferring correctly unless there is something wrong with the SV setup.  Also, is the order of the wait in the top (consumer) loop supposed to just throttle the loop or is it supposed to have a specific order associated with it (i.e. wait 100 ms and then check the shared variable)?  Either way the wait is not necessary - simply have the notifier timeout and get rid of sending a false notifier:

20765iD8640DE3F485A5B3

 

or Danny could use timed loops:

 

20767i5B9FA1F3C5CC89E0

 

And finally - Danny, why are you using a shared variable?  If there is no network connection and you are not trying to transmit data over a network, there seems to be no need for this; you could use a global variable if necessary, but there are other ways to rejigger the VI so that you don't need any of this, like this:

 

 

20769i8B2C3AEF0BBC9812

 

Anyway, these are just some thoughts.

 

Cheers, Matt

0 Kudos
Message 4 of 6
(4,522 Views)

Matt,

 

My hardware is compact a field point system running real-time.  My current code probably doesn't need to use shared variables, however I was under the impression that when programming for a real-time target shared variables were necessary to update information between the host VI and the real-time target as well as between sub-VI running on the real-time target.  I'm not a programmer  and my labView experience is limited so the help from the message board has always been very helpful and educational.  

 

Thanks again.

Danny
0 Kudos
Message 5 of 6
(4,510 Views)

AND...this has also been helpful for my application, though there are a number of structures (and the notifiers!) that are new to me.  My LV experience started with 0.772 (!), but kind of trailed off after LV 6, so I have some homework ahead of me...

 

Paul D

0 Kudos
Message 6 of 6
(4,503 Views)