06-15-2026 09:42 AM
Hello gents,
I need your help to understand how I can read sensor data using DAQ assistance and data log it in two different loops. As shown in attached picture, The vi works as reading accurately, data logging, but when I press stop the vi doesn't stop. I need the producer loop to work in high rate and at the same time I want to data log the current value each 2 seconds. What is the mistake I am doing here.
Solved! Go to Solution.
06-15-2026 10:07 AM
It is hard to debug pictures, especially if some terminals don't even have labels (a very big no-no!).
Please attach your VI. Make sure to do a "save for previous" (2020 or below).
06-15-2026 10:26 AM
Change your Notifiers to Queues! I admit that the end Logging on Error is probably bad BUT, writing Notifier data to file is WRONG WRONG WRONG.
06-15-2026 10:30 AM
You have a very common race condition with your Notifiers.
What is happening with the Notifier is you are writing a TRUE to the Notifier and then end the loop and close the Notifier. All of this happens 99.99% of the time before the upper loop can read the notification. Since the Notifier is no longer valid, you get a default value of FALSE from the Wait On Notification.
In this situation, I would use a Channel Wire to replace both of your Notifiers. With a Streaming Channel Wire, you get an extra parameter for "Final Value?". You can use that to stop your loop instead of an extra notification.
Also, your consumer loop should really run as fast as it can. You can use a timer or loop counter to conditionally write your data instead of having a large loop delay.
06-15-2026 10:42 AM
@crossrulz wrote:
You have a very common race condition with your Notifiers.
Not really all that common, nor is it a classic Race. -1 wired to a notifier tmo means no True tmo can exist. What we have here is an infinite loop! Lots of other problems exist in the code! Concepts of lossy vs lossless data transfer are fundamental to any DAQ measurement and Logging application.
There are just so many features wrong in the OP (picture) that you should not confuse the poster by incorrectly claiming a race condition exists as well as all the other problems. Jeeze, Tim!
06-15-2026 10:47 AM
See attached.
06-15-2026 10:56 AM
@JÞB wrote:
Change your Notifiers to Queues! I admit that the end Logging on Error is probably bad BUT, writing Notifier data to file is WRONG WRONG WRONG.
The queues (in default configuration) would grow forever because they are constantly getting stuffed, but only read every 2 seconds. Channel wires would be a good suggestion.
(The notifier would work if you would close it in the right order. Also only one notifier would be needed, containing a cluster of boolean and numeric.)
06-15-2026 11:04 AM
Hi Albert, I did the cluster for numeric and Boolean, it did the same thing, reading, recording, but stop is not working. I will try the channel wires and see what will happen.
06-15-2026 11:06 AM
@Omar-Abdelhameed wrote:
See attached.
What you really want is a "Producer Consumer" loop. In fact, there is a template for that you can find in by selecting menu>>New.. From Template.
Tim (crossrulz) and Christian (Altenbach) can help you get the code doing what you want it to do! Unfortunately, you wrote a "highly Featured " snippet of code .
06-15-2026 11:14 AM
@Omar-Abdelhameed wrote:
Hi Albert, I did the cluster for numeric and Boolean, it did the same thing, reading, recording, but stop is not working. I will try the channel wires and see what will happen.
Who is Albert? did you move the close notifier after the upper loop or add some simple data dependency to delay closing the notifiers only after the upper loop completes?
You could also just stop the upper loop on error, completely eliminating the boolean notifier. Once the notifier closes, there will be an error and the upper loop would stop.