Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

M Series Data Acquisition with Digital Trigger

Hi
 
I am very new to the field of Data Acqusition and I am currently working on a project that requires it. I am running Linux system and I finally have the NI 6220 DAQ working. I am using C as the programming language. I managed to run the Acq-IntClk.c example without any problem. The problem arises when I am trying to use Acq-IntClk-DigRef and Acq-IntClk-DigStartRef examples. It just seems like I am being dumb and doing something incorrectly.
 
I have an external clock that runs at 10% duty cycle with the pulse width of 2ms. I need the DAQ to be acquiring data only during the pulse width... well that's for the long run... Right now I just need to be able to start the reading on the rising edge of this external clock driven by another timing card.
 
Right now I have connected ai0 to the analog voltage and the PFI0 is connected to the external clock.
 
Can someone who's already got DAQ working with digital trigger help me out with this.... I'll probably need a step by step help to get this example working.
 
Thank you very much...
 
Kaushal
0 Kudos
Message 1 of 2
(2,845 Views)
Hi Kaushal,
 
If you look at these lines of code from the example:
 
DAQmxErrChk (DAQmxCfgDigEdgeStartTrig(taskHandle,"/Dev1/PFI0",DAQmx_Val_Rising));
DAQmxErrChk (DAQmxCfgDigEdgeRefTrig(taskHandle,"/Dev1/PFI1",DAQmx_Val_Falling,100));
 
The first line configures a start trigger on PFI0. When the first rising edge is detected on PFI0, you will start latching in data to a buffer.
The second line configures a reference trigger on PFI1. When the first rising edge is detected on PFI1, it will pull 100 pretrigger (relative to the edge on PFI1) samples and the remaining samples specified by DAQmxCfgSampClkTiming() and return them when you call DAQmxRead. So to start with, if you remove the Reference trigger, your start trigger will start the acquisition and return data when DAQmxRead has been called. Also, you could just send a trigger to PFI1 when you want to acquire. This should get you started.
 
Your end goal, "I have an external clock that runs at 10% duty cycle with the pulse width of 2ms. I need the DAQ to be acquiring data only during the pulse width" is going to be more complicated. You'll need to use counters to achieve this. This KB:  How Can I Perform a Retriggerable Acquisition?  has a great overview and links to examples that should be closer to what you want.
 
Hope this helps,
Andrew S
National Instruments
0 Kudos
Message 2 of 2
(2,832 Views)