Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

I got only one data in array (VC use DAQmxReadAnalogF64)

static int32 daq_Status;
static TaskHandle daq_handle;
static float64 data[1024];
static int32 readsample;
long ErrorCode;

daq_Status = DAQmxCreateTask ("TEST_ai", &daq_handle);
daq_Status = DAQmxCreateAIVoltageChan (daq_handle, "Dev1/ai0", "ai0", DAQmx_Val_Cfg_Default, -5.0, 5.0, DAQmx_Val_Volts, "");
daq_Status = DAQmxStartTask (daq_handle);
daq_Status = DAQmxReadAnalogF64 (daq_handle, DAQmx_Val_Auto, 10.0, DAQmx_Val_GroupByChannel, data, 1024, &readsample, 0);
//daq_Status = DAQmxReadAnalogF64 (daq_handle, DAQmx_Val_Auto, 10.0, DAQmx_Val_GroupByChannel, data, 1024, &readsample, 0);
daq_Status = DAQmxStopTask (daq_handle);

Why my data array only position 0 has value and other position is zero.
And if the same code use in LabWindow the data array is correct
0 Kudos
Message 1 of 2
(3,194 Views)
You need to add a call to DAQmxCfgSampClkTiming() before you start the task. That function includes a parameter to tell DAQmx now many samples to take.
John Weeks

WaveMetrics, Inc.
Phone (503) 620-3001
Fax (503) 620-6754
www.wavemetrics.com
0 Kudos
Message 2 of 2
(3,188 Views)