LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to stop a continuous acquisition in Producer/Consumer

Solved!
Go to solution

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

0 Kudos
Message 1 of 11
(3,545 Views)

Please post the vi in 2009 version.

-----

The best solution is the one you find it by yourself
0 Kudos
Message 2 of 11
(3,544 Views)

Hi Anand,

 

Thanks for response. I've just made a 2009 version, please check!

 

Bing

0 Kudos
Message 3 of 11
(3,539 Views)

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.

-----

The best solution is the one you find it by yourself
0 Kudos
Message 4 of 11
(3,535 Views)

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.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 5 of 11
(3,532 Views)

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?

0 Kudos
Message 6 of 11
(3,524 Views)
Solution
Accepted by topic author liubingxy

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.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 7 of 11
(3,519 Views)

Thank you! I will try this one. 

0 Kudos
Message 8 of 11
(3,514 Views)

Great! It works. It is exactly what I am looking for! thanks again!

0 Kudos
Message 9 of 11
(3,508 Views)

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

0 Kudos
Message 10 of 11
(3,472 Views)