09-08-2009 11:27 AM
Hello,
I'm currently trying to use the usb 6009 to acquire analogue input on a digital trigger. Essentially, I have an aerotech motor that sends ttl pulses at given positions as it scans an optical stage back and forth. I wish to use the 6009 to take position synchronized measurements of a digital signal from the apparatus that this motor is attached to.
Currently, the data acquisition part of my code looks like this.
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
float64 min_volt = -10.0;
TaskHandle taskHandle = 0;
DAQmxBaseCreateTask("",&taskHandle);
DAQmxBaseCreateAIVoltageChan(taskHandle, rchan, "", DAQmx_Val_Cfg_Default, min_volt, max_volt, DAQmx_Val_Volts, NULL); //create analogue voltage input channel
DAQmxBaseCfgDigEdgeStartTrig(taskHandle, tchan, DAQmx_Val_Rising);
DAQmxBaseStartTask(taskHandle);
for(int x = 0; x < entries; x++)
{
DAQmxBaseReadAnalogF64(taskHandle, pointsToRead, timeout, DAQmx_Val_GroupByChannel, &data[x], 1, &pointsRead, NULL);
}
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
When I run this code, data is acquire regardless if I turn the triggering signal on or off, leading me to the conclusion that I am doing things improperly.
Any help would be greatly appreciated.
thanks,
-Aaron
09-09-2009 06:58 PM
Hi anguta,
You are missing your timing, DAQmxBaseCfgSampClkTiming, between creating your channel and configuring your digital trigger.
09-10-2009 03:33 PM
Thanks, that deffinitly did the trick. I have one last question though. Given an onboard sample clock, does the adc begin recording immediatly upon recieving the trigger and take all successive recordings at your prespecified sampling rate or wait some ammount of time after the trigger before the first recording.
thanks,
-Aaron
09-11-2009 06:12 PM