07-03-2012 11:57 AM
Hi,
I am using the NI-DAQmx C API with the simulated PCIe6353. If I set the rate twice using DAQmxCfgSampClkTiming before starting my task , the acquisition stops as soon as it is started. If I set the rate only once, the acquisistion seems to run fine.
I have a algorithm that sets the rate for different devices. This works fine for all USB X-series and also M-Series devices.The code shown below is a small snippet of my algorithm to show the issue:
DAQmxErrChk (DAQmxCreateTask("",&taskHandle)); DAQmxErrChk (DAQmxCreateAIVoltageChan(taskHandle,"Dev3/ai0","",DAQmx_Val_Cfg_Default,-10.0,10.0,DAQmx_Val_Volts,NULL)); DAQmxErrChk (DAQmxCfgSampClkTiming (taskHandle, "OnboardClock", 1000, DAQmx_Val_Rising, DAQmx_Val_FiniteSamps, 2)); DAQmxErrChk (DAQmxGetSampClkRate (taskHandle, &rate)); DAQmxErrChk (DAQmxCfgSampClkTiming (taskHandle, "OnboardClock", 1000, DAQmx_Val_Rising, DAQmx_Val_FiniteSamps, 1000)); DAQmxErrChk (DAQmxGetSampClkRate (taskHandle, &rate)); DAQmxErrChk (DAQmxRegisterEveryNSamplesEvent(taskHandle,DAQmx_Val_Acquired_Into_Buffer,1000,0,EveryNCallback,NULL)); DAQmxErrChk (DAQmxRegisterDoneEvent(taskHandle,0,DoneCallback,NULL));
Please find attached the C file I am using.
Best Regards,
Manisha
MathWorks
07-06-2012 04:43 PM
Hello Manisha
I do not see a reason why the code is stop, as if you call the timing function twice over the same task, the second time you call the function it will override the setting from the previous call, my guessing is that another error occurs ( coould be a buffer overflow or under flow? ) that generates an error and stops the program, can you verify if some error is ocurring ?
regards
Mart G