From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Analog input sampling in C/C++

Using a PCIe6323 to capture continuous analog inputs.  I have 32 points of which I want to monitor the current state continuously.  I can't seem to get this to work without various errors.  Right this moment I have this:

 

DAQmxErrChk (DAQmxCreateTask("",&taskHandleAI));
DAQmxErrChk (DAQmxCreateAIVoltageChan(taskHandleAI,"Dev1/ai0:31","",DAQmx_Val_Cfg_Default, 0.0, 5.0, DAQmx_Val_Volts,NULL));
DAQmxErrChk (DAQmxCfgSampClkTiming(taskHandleAI,"",10000.0,DAQmx_Val_Rising, DAQmx_Val_FiniteSamps,1000));

 

DAQmxErrChk (DAQmxReadAnalogF64(taskHandleAI,2,10.0,DAQmx_Val_GroupByScanNumber,dataAi,1000,&readAi,NULL));

 

I have to Stop and Clear the tasks and re-create each cycle in the continuous loop, which seems like the wrong way to do it but it's the closest I've been to proper function.  Right now I get error -200019.  

 

How can I get this to sample continuously?  

 

Thanks

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

Hi gsochurek, 

The error you are currently receiving (-200019) occurs when an ADC conversion is attempted before the prior conversion completes.  Generally the solution is to decrease the sampling rate so that there is time for each conversion to complete.

More information can be found in this KnowledgeBase article: http://digital.ni.com/public.nsf/allkb/1275F44215D5C13F862579AE006CA222?OpenDocument

Regards,
Kelly B.

National Instruments
0 Kudos
Message 2 of 2
(3,828 Views)