Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

How to make sweep without stop a task?

Hello,

 

I am using CVI 8.0 and a NI 9263 card for my aplication. I need to make a sweep from 20 Hz to 6Khz whit a step of 20 Hz.

Im actuallly generating a signal by executing the next code:

 

// To generate

DAQmxCreateTask( "", &taskHandleGen);
DAQmxCreateAOVoltageChan( taskHandleGen, parameters.data, "", -10.0, 10.0, DAQmx_Val_Volts, NULL);      
DAQmxCfgSampClkTiming( taskHandleGen,"", dataSamp, DAQmx_Val_Rising, DAQmx_Val_ContSamps, Rate);
DAQmxRegisterDoneEvent(taskHandleGen,0,DoneCallback,NULL);
DAQmxWriteAnalogF64( taskHandleGen, Rate, 0, 10.0, DAQmx_Val_GroupByChannel, data, NULL, NULL);
DAQmxStartTask(taskHandleGen);

 

//To stop

DAQmxStopTask(taskHandleGen);
DAQmxClearTask(taskHandleGen);

 

Im generating the sweep by creating a task and then stop the task, then the frecuency increments 20 Hz and again creates a task and then stop again and the cycle repits until the max frecuency is reached.

 

Doing the sweep this way is a problem because every time i stop the task the signal is interrupted for a little period of time. I need this to be always continuos.

 

Is there a way to "refresh" the frecuency of my signal without stop the task?

 

Thanks.

 

 

 

 

0 Kudos
Message 1 of 2
(3,056 Views)

You can write to the task while it is running--it would look something like this in LabVIEW.

 

The DAQmx C API is pretty much 1:1 with the LabVIEW API, so looking at that example should be a good starting point (I'm not sure where to find a non-regeneration C example unfortunately).  The Basic Function Generator in LabVIEW is not part of DAQmx but it is used in the example to build a continuous waveform (it keeps track of phase between calls).  

 

The idea is that you write an initial buffer, start the task, and then continuously write new data to the buffer while the task is running (if you don't keep up, you'll get a buffer underrun error).  It would be up to you to build the correct data to write to the DAQ card that accomplishes your frequency sweep.

 

 

Best Regards,

John Passiak
0 Kudos
Message 2 of 2
(3,048 Views)