Measurement Studio for VC++

cancel
Showing results for 
Search instead for 
Did you mean: 

Simple AI Trigger

Hi,
 
I'm trying to do a simple analog input controlled by an external start trigger.
I apply a 5V TTL signal to the PFI0 line on my NI6220 board, and expect the acquisition to start sampling data inputs on my ai channels:
 
In pseudo-like code I do the following:

DAQmxErrChk( DAQmxCreateAIVoltageChan(s_hTask,"Dev1/ai0","",DAQmx_Val_RSE,-10,10,DAQmx_Val_Volts,NULL) );
DAQmxErrChk( DAQmxCfgSampClkTiming(s_hTask,"OnboardClock",100000,DAQmx_Val_Rising,DAQmx_Val_FiniteSamps,10000) );
DAQmxErrChk( DAQmxCfgDigEdgeStartTrig(s_hTask,"PFI0",DAQmx_Val_Rising) );
DAQmxErrChk( DAQmxStartTask(s_hTask) );
while (...)
   DAQmxErrChk( DAQmxIsTaskDone(s_hTask,&bTaskDone) );
DAQmxStopTask(s_hTask);
DAQmxErrChk( DAQmxReadAnalogF64(s_hTask,DAQmx_Val_Auto,0,DAQmx_Val_GroupByScanNumber,DataPtrF64,10000,&read,NULL) );

And this generated the -200284 error ???

I can see that the trigger works, because DAQmxIsTaskDone is returning FALSE until after I apply the external trigger signal. And I can also see that
the time between the trigger and the DAQmxIsTaskDone return TRUE is dependent on the number of sampels requested. So something is working, but
the DAQmxReadAnalogF64 always returns error.
What I'm I doing wrong?

-cpede

Message Edited by cpede on 07-27-2005 10:07 AM

0 Kudos
Message 1 of 3
(3,350 Views)

I have now tested on my PCI-6220, and PCI-6143, and I see the same behavior.

I must do something fundamentally wrong, please help....

-cpede

0 Kudos
Message 2 of 3
(3,336 Views)
Figured out my self, should not call DAQmxStopTask before reading data.
 
The funny this is, that it worked fine without triggering, just starting the measurement on the start task.
 
-cpede
0 Kudos
Message 3 of 3
(3,334 Views)