05-01-2009 09:21 PM
I have this simple occurence, and I need to know why the value of a, and b are not equal. Afterall, the while loop on the right is suppose to iterate before the while loop on the left.
So I expect to see the same value. Thanks for any explanation. I have attached the picture file.
Solved! Go to Solution.
05-01-2009 09:51 PM
05-01-2009 10:04 PM
I admit from the picture I don't see what's happening, but I'll throw in a general suggestion that could be related.
Always consider using Notifiers instead of Occurrences. My biggest complaint about occurrences is that an instance of the Generate Occurrence function on a diagram will output the same occurrence reference every time it executes, not a new reference. This means it's possible that the Wait on Occurrence function could accidentally get triggered from an old occurrence if Ingore Previous is not true. And if it is true, then you run the danger of missing the occurrence in the first place due to race conditions.
Notifiers have all the functionality of occurrences and more, and they avoid this problem because you have the control over opening and then closing separate references as needed.
05-01-2009 10:19 PM
Thanks guys, I have attached the file. I use LabVIEW 8.6, but I am not getting the same value for the two while loop iteration.
Actually, I am trying to learn occurrrences, that is why I am running the program.
I have attached the code
05-01-2009 10:43 PM - edited 05-01-2009 10:44 PM
What you are seeing here has nothing weird to do with occurrences at all. They are performing exactly as they should. You can verify that by placing a breakpoint before the Set Occurrence function as shown below. You can then control exactly when the occurrence is set by unpausing the VI. You'll see then that both loops are at the same iteration.
The iteration counts merely appear to be different because the loop that waits on the occurrence has a shorter wait, so it is at least trying to run faster more often than the slow loop that sets the occurrence. This means it will start its iteration sooner and update the Iteration indicator before it waits for the Occurrence to be set, which then resynchronizes the loops.