08-31-2012 09:53 AM
Hi,
I try to use Producer/Consumer to control "Start" and "Stop" of my continuous data acquisition system. I can successfully start the acquisition process, but I cannot stop it by "Stop" botton.
I have attached my simplified VI. Can anybody help to have a look at it and tell me what is wrong there?
Thanks,
Bing
Solved! Go to Solution.
08-31-2012 09:59 AM
Please post the vi in 2009 version.
08-31-2012 10:06 AM
Hi Anand,
Thanks for response. I've just made a 2009 version, please check!
Bing
08-31-2012 10:11 AM
You have kept the dequeue outside the loop that means your consumer will run once in an execution and runs the same input what it got at the start. Keep the dequeue inside the while loop.
08-31-2012 10:15 AM - edited 08-31-2012 10:18 AM
Your Dequeue needs to be inside of the loop in order to read it constantly. You should also set the timeout for the Dequeue to the 200ms and handle the timeout somehow.
Based purely on what I see in this example, a Notifier would probably be a better tool for you.
08-31-2012 10:20 AM
But in this way, when hit "start", it acquires only one point and wait for me to hit it again to acquire another point. I need the acquisition running continuously and stop only when I hit "Stop". Do you know how to implement this?
08-31-2012 10:47 AM - edited 08-31-2012 10:47 AM
As I said before, use a notifier and handle the timeout. I used a select with the Timeout? boolean. If a timeout happened, use the previous value. If we got a notification, use that value.
08-31-2012 10:50 AM
Thank you! I will try this one.
08-31-2012 11:13 AM
Great! It works. It is exactly what I am looking for! thanks again!
08-31-2012 10:37 PM
Hi crossrulz,
Followed your way, I intergrated the Notifier scheme into my LabVIEW codes, but got a problem.
Because I finally need to store my data into a file, I have to output the data outside the while loop. When I do this, the "empty False case" gives a lot of zeros, before I hit start to acquire the real data. Do you know how to deal with this "empty False case", to not acquire those default zeros?
please check my VI
thank you
Bing