Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Analog aqcuired waveform: Missing samples or ai/clk jumped?

Hi,
Using the NI6281 device I am trying to aqcuire a sine wavefrom from an external generator of about 1kHz (In LabWindows CVI). When the waveform is plotted there are random jumps in the sampled voltage, almost as if the ai/SamlpleClk paused for a short time. At first I thought it may be because there were multimule tasks running but this still occurs when only  the ai task is running. When the array is examined the missing / pause in ai/clk  is easily seen. Code is below
 
int airead = 0;
float64 aidatain[1000] = {0};
 
//Analog AC Sine capture
DAQmxCreateTask ("", &AItask);
DAQmxCreateAIVoltageChan (AItask, "Dev1/ai5", "", DAQmx_Val_RSE, -2.0, 2.0, DAQmx_Val_Volts, "");
DAQmxReadAnalogF64 (AItask, 1000, 10.0, DAQmx_Val_GroupByChannel, aidatain, 1000, &airead, 0);
DAQmxWaitUntilTaskDone (AItask, 10.0);          
DAQmxClearTask (AItask);
PlotY (toppanel, TOPPANEL_aoWAVEFORM, aidatain, 1000, VAL_DOUBLE, VAL_THIN_LINE, VAL_EMPTY_SQUARE, VAL_SOLID, 1,
    VAL_RED);
 
This frequency should be easily sampled for such a fast device, what am I doing wrong?
0 Kudos
Message 1 of 3
(2,503 Views)
You haven't configured the timing for the device, so it is not performing a hardware timed acquisition.  As you have it, it is performing a software timed acquisition, so the program (and data acquisition) is at the mercy of the OS thread scheduler.  To perform a hardware timed acquisition, you are just missing a couple functions (DAQmx Timing, Start & Stop functions).  Take a look at the shipping examples.  In CVI, goto Help>>Find Examples.  Navigate to Hardware Input and Output>>DAQmx>>Analog Measurements>>Voltage.  Then look at Acq-IntClk.prj.  Or, outside of CVI, browse to your National Instruments directory, go to NI-DAQ\Examples\DAQmx ANSI C\Analog In\Measure Voltage\Acq-Int Clk.
-Alan A.
 
0 Kudos
Message 2 of 3
(2,495 Views)
Hi Alan,
   Thanks for the information. Sorry about posting 3 empty mesaages, I had used the TAB key then <return> by mistake.
 
Andy.
0 Kudos
Message 3 of 3
(2,486 Views)