Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

USB-6009, acquiring analogue output on a digital edge. cnfgDigEdgeStartTrig seems to do nothing.

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;
float64 max_volt = 10.0;
char rchan[] = "Dev1/ai0";               //name of analogue in channel
char tchan[] = "Dev1/PFIO";              //name of triggering channel
float64 timeout = 0.5;
stringstream converter;
int32 pointsToRead=-1;
int32 pointsRead;

 


    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 

0 Kudos
Message 1 of 4
(2,941 Views)

Hi anguta,

 

You are missing your timing, DAQmxBaseCfgSampClkTiming,  between creating your channel and configuring your digital trigger.

Regards,


h_baker
National Instruments
Applications Engineer
0 Kudos
Message 2 of 4
(2,914 Views)

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 

0 Kudos
Message 3 of 4
(2,898 Views)
The acquisition will begin when the trigger is received.  Review to Waveform Acquisition Using a Digital Start Trigger for a more in depth explanation.  Hopefully this helps, let me know if you have any additional questions.  Have a nice weekend!
Regards,


h_baker
National Instruments
Applications Engineer
0 Kudos
Message 4 of 4
(2,885 Views)