LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

program wont end (while loop stop control)

Hi,

I have a data acquisition set up to acquire data for 100 ms (rate=10000 S/s, samples= 1000) when the PFI line on my DAQ device recieves a digital trigger. The entire code is in a while loop with a control wired to the stopping condition. The timeout on my DAQ assistant is set to -1, because I want the program to wait for the user to send the trigger signal. When I press the stop control on the front panel, the program doesn't end. I believe this is because the DAQ assistant is waiting to acquire data indefinitely because the time out is set to -1. I need the program to end when that stop control is pressed. 

 

Any suggestions?

 

Thankyou

0 Kudos
Message 1 of 9
(3,427 Views)

Show us your code.

0 Kudos
Message 2 of 9
(3,421 Views)

And of course you started with a DAQ assistant.  Go back and start with one of these http://www.ni.com/white-paper/14121/en/

 

Now you have a framework that does what you want and responds to the user.


"Should be" isn't "Is" -Jay
0 Kudos
Message 3 of 9
(3,407 Views)

This isn't the exact program, but its the same problem.

 

Also, I have a rising trigger to start acquisition.

0 Kudos
Message 4 of 9
(3,390 Views)

Put in a timeout and see what happens.  If you don't get your data, you just skip the checking of the data.  Loop until you get your stop condition.


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 9
(3,383 Views)

If I set a timeout and hit the stop control, the program waits for the timeout that I set and returns an error (200284).

0 Kudos
Message 6 of 9
(3,379 Views)

@MTB77 wrote:

If I set a timeout and hit the stop control, the program waits for the timeout that I set and returns an error (200284).


Is this a problem for you, or just a comment?

0 Kudos
Message 7 of 9
(3,373 Views)

A problem. When I press stop, I want the program to end immediately. Instead, it waits for the timeout then displays an error message. How do I get it to end as soon as I press stop?

0 Kudos
Message 8 of 9
(3,370 Views)

Then you need a more suiable archetecture.  Start from a Finite measurment project template.  Call DAQmx Control Task with Abort as the input to end your task immediatly.  The DAQ assistant is not going to work for you.

!1.png


"Should be" isn't "Is" -Jay
0 Kudos
Message 9 of 9
(3,358 Views)