LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Where are the occurrence gurus?

How can I achieve the following (see vi below): With each iteration of the for loop the occurrence should be triggered, so that the case structure in the while loop gets executed. I used local variables (continous polling) and it worked fine, however it doesn't work with occurrences,maybe because I'm not familiar with this topic.
Furthermore, is there a way how to assure that the next iteration of the for loop gets executed ONLY after the previous execution of the while loop (caused by the occurrence in the for loop) has finished?

Any help gratefully received,

Georg
0 Kudos
Message 1 of 4
(2,847 Views)
It appears to me that it is triggered. I put indicators on both of the iteration counters and they track exactly. With the difference in wait times they would run at different rates if the triggering were not dominating.

However, Timed Out on the Wait on Occurrence function is always false if the time out is left at the default (-1), never time out. Since that is false your True case never executes. Since you have a Wait on Occurrence you do not need the Wait (ms) function. Just set the timeout on the Wait on Occurrence to 50 ms. The LV Help file on Occurrences suggests using Notifier functions for this type of work.

Your second question is somewhat more difficult to answer without knowing what else your loops do. My first suggestion would be to conside
r putting the triggering and the data acquisition in different states (cases) of a single state machine. Then it would be easy to start acquistion after a trigger and to enable the next trigger generation only after the acquisition is complete. I like a model where the acquisition, usually including the triggering, is in one loop and the processing of data is done in another with queues passing commands and data between loops. The GUI is in a third loop.

Lynn
0 Kudos
Message 2 of 4
(2,847 Views)
I modified the program, but still it doesn't work. The indicator doesn't flash. Why not?
I basically want the occurrence function to return TRUE only if it gets triggered in the for loop and not when it times out!
0 Kudos
Message 3 of 4
(2,847 Views)
Georg,

Since you are using LabVIEW7, you can make use of notifiers. Think they pretty much do everything that you were asking. I have modified your VI so you can see the LED flash, but then added some extra code using notifiers.

The big differences are that you dont have any timeouts until you stop generating the trigger, then its a simple case of stopping when a timeout occurs, and also that the two are in synch.

Best Regards

Anthony Sims
National Instruments - UK
0 Kudos
Message 4 of 4
(2,847 Views)