LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to add stop button to myDAQ loop

Hi ,

im last semester student and during my final project im recroding lung sound with electret microphone sampling it with myDAQ and writing it to a wav file. the acquisition mode is "continuous samples" , the recording time is changing from time , i want to add a "STOP" button , which will be pushed when i finished my recording . If i push on the "abort execution" button , the wav file is empty , and so on the graph. any suggestions ?

 

thank you in advance.

 

0 Kudos
Message 1 of 8
(3,397 Views)

Like this

 

 

By the way, that Abort VI button is not for stopping your loops.  I just kills execution wherever it may be.  It should only be used as a last resort if your stopping code is not working properly.


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 2 of 8
(3,384 Views)

i'v added the stop control as you explained  , and it seems that this is not working , it continue do collect data , and the final length is always the same (samples/sample rate).

 

Capture.JPG

0 Kudos
Message 3 of 8
(3,342 Views)

That is because you are only logging the last acquisition.  Maybe you should move the saving of the data into the loop.  You should open the file before the loop and pass the reference into the loop.  You can then write to the file inside of the loop.  You really should also be sure to close the file after your loop.


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 4 of 8
(3,309 Views)

can you please explain how it should be look like . 

0 Kudos
Message 5 of 8
(3,262 Views)

Like this


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 6 of 8
(3,254 Views)

i did exactly as you told , and it is not working , for example if my sampling rate is 44.1k , and samples to read is 441k , if i push on stop after 5 seconds , it records me everyting , (10 sec).Capture.JPG

0 Kudos
Message 7 of 8
(3,209 Views)

Yes, it is doing exactly as you have programmed.  You told the DAQ Assistant to read 10 seconds worth of data.  So it will do that or timeout trying.  If you want more precision in your stop, then tell the DAQ Assistant to read fewer samples.  If you have the sampling rate at 44.1kHz, set the number of samples to read to 44100.  That will cause the DAQ Assistant to read 1 second worth of data, giving your stop condition a 1 second resolution.


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 8 of 8
(3,196 Views)