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.
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.
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).
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.
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).
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.