05-18-2007 12:18 PM
05-21-2007 02:50 PM
Hi Nia,
Thank you for posting to the National Instruments Discussion Forums.
You should be able to stop the task, reset the timing parameters using DAQmxCfgSampClkTiming and then re-starting the task.
Did you see this error when you tried to reset the sampling rate while your acquisition was running?
05-21-2007 03:13 PM
Hi Abhinav,
No, I didn't try stopping the task, resetting the sample rate, then starting the task again. From previous posts, it sounded like stopping/starting the task was not an efficient solution. But if this is the only way to reset the sample rate, I will do that.
Thanks,
Nia
05-21-2007 04:38 PM - edited 05-21-2007 04:38 PM
Message Edited by NF1 on 05-21-2007 04:40 PM
05-22-2007 10:28 AM
Nia,
You shouldn't need to clear the task. Can you try resetting the sample clock for only the read task? Also can you post a snippet of the DAQmx code you are using to reset the sampling rate?
Thanks,
05-22-2007 08:32 PM
Hi Abhinav,
There's a snippet of code in my original post, if you can refer to that.
If I just call DAQmxCfgSampClkTiming() for the read task (and move the call by the write task outside of the loop) I don't get an error, but the code runs *much* slower.
I did notice once that I was able to change the sample rate for both the read and write tasks one time, but got an error when I tried changing the sample rate a second iteration. I'm wondering if this was a fluke (mistake on my part), a timing issue, or something else. I may try calling DAQmxCfgSampClkTiming() outside of the loop with the highest sample rate I want to use, then see if I'm able to reset the sample rate in my loop. Any thoughts?
Thanks,
Nia
05-23-2007 02:56 PM
Nia,
Few things you might want to try:
- I saw that you were configuring the output buffer after starting the task - can you try calling that before you start the task?
- Sample both channels at the maximum possible rate and then decimate the input values
05-25-2007 05:25 PM - edited 05-25-2007 05:25 PM
Message Edited by NF1 on 05-25-2007 05:25 PM
05-30-2007 11:49 AM - edited 05-30-2007 11:49 AM
Hi Abhinav,
It looks like the resources for the tasks need to be unreserved in order to reset the sample rate within the loop. Calling DAQmxTaskControl() with action set to DAQmx_Val_Task_Unreserve within the loop before the call to DAQmxCfgSampClkTiming() does the trick.
Thanks for you help,
Nia
Message Edited by NF1 on 05-30-2007 11:50 AM
Message Edited by NF1 on 05-30-2007 11:50 AM