LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Simple question on queues and notifiers

Hi gang,

This is probably a pretty simple question and I'm guessing the answer is "yes", but I just want to make sure because due to timing constraints, it's hard to debug.

I have a while loop with a counter, a notifier, and an enqueue function. A screen shot is attached. I used to have a sequence surrounding the "Wait on Notification" that also took in the shift register that controls the state machine. My question is this: Can I eliminate it (as I have done in the screen shot) and have it run just fine, knowing that the original purpose was to wait for a response to the enqueued data (which is transmitted in a separate while loop) from external hardware. I guess it boils down to this: Will the enqueue function be held up by the wait for notifier?

Thanks,

Jason
0 Kudos
Message 1 of 4
(2,423 Views)
From looking at your code I would say no the Enqueue will not wait on the notifier.

The Enqueue waits for the case structure, which waits for the value from the shift register.

The notifier on the other hand starts waiting as soon as the loop starts, however it has no relationship to the queue operations. If you want the queue operations to occur after the notification, the easiest thing to do would be to use the error out of the notifier into the Enqueue VI. Then you are assured that the notifer and then the queue will execute.
Message 2 of 4
(2,418 Views)
Oh sorry, I think I miscommunicated my goal. The only goal is to ensure that the loop does not proceed to the next iteration before BOTH the enqueue function execute AND the 'wait for notifier' either receives the confirmation that the enqueued command has completed or it times out. But now you mention it, making sure the enqueue function executes first is a great idea - that way, I don't have to worry about inadvertent timeouts (which, I must admit, I have seen)

Thanks!

Jason
0 Kudos
Message 3 of 4
(2,406 Views)
Glad I could help. To answer your actual question, here is a good way to think of all LabVIEW structures, loops, case structures, sequences etc... is miny diagrams. So the entire diagram must complete before the structure is done. So in your code you will always get a 1 to 1 relationship between notifications or timeouts and queued items. Everything in the loop must complete before the loop iteration is complete and can start over.
Message 4 of 4
(2,402 Views)