10-11-2013 09:04 PM - edited 10-11-2013 09:25 PM
Hello all, I am a DAQmx programming novice. I am attempting to write an application in ANSI C and would like to set up a PCI 6115 board to do an analog to digital conversion on one channel each time an analog signal goes above a threshold on another channel. The sampling will be occuring at approximately 2.5 MHz, I believe this is too fast to simply rearm the trigger and acquire a single sample.
My thought process is that I need to use the DAQmxCfgSampClkTiming function to set up an external clock. My first thought is that I should use the output from an analog trigger function as the source[] in the DAQmxCfgSampClkTiming function. The only analog trigger functions in the DAQmx library that I found are DAQmxCfgAnlgEdgeRefTrig and DAQmxCfgAnlgEdgeStartTrig and neither of those appear to do what I want. Any suggestions would be most appreciated.
Chris
10-14-2013 11:17 AM
After researching a bit more I believe I need to use the following:
/*********************************************/
// DAQmx Configure Code
/*********************************************/
DAQmxErrChk (DAQmxCreateTask("",&taskHandle));
DAQmxErrChk (DAQmxCreateAIVoltageChan(taskHandle,"Dev1/ai0","",DAQmx_Val_Cfg_Default,-10.0,10.0,DAQmx_Val_Volts,NULL));
DAQmxErrChk (DAQmxCfgSampClkTiming(taskHandle,"/Dev1/AnalogComparisonEvent",1000.0,DAQmx_Val_Rising,DAQmx_Val_FiniteSamps,1000));
DAQmxErrChk (DAQmxCfgAnlgEdgeStartTrig(taskHandle,"APFI0",DAQmx_Val_Rising,1.0));
The key being using the AnalogComparison Event as the source of the clock.
10-14-2013 11:46 AM
cderose,
Based on the description of the type of acquisition you are trying to achieve there is no need for an external clock. The NI PCI-6115 is capable of using an internal sample clock to trigger acquisition of N-samples on a specific channel based on the trigger input of another analog channel. The ANSI C example Acq-Int Clk-Anlg Start should give you all the information you need to code the DAQmx task. This example can be found in C:\Users\Public\Documents\National Instruments\NI-DAQ\Examples\DAQmx ANSI C\Analog In\Measure Voltage\.
As a note the PCI-6115 is not retriggerable. This is a hardware dependency and the work around is that you will have to stop the task after the acquisition and immediately restart the task to acquire the next sample. If you are interested in retriggerable hardware look into the Xseries DAQ cards. I provided a link to the Xseries cards, but I would check the hardware specs for any specific specification needed for your application.
Mark B.
10-14-2013 02:56 PM
Hello Mark, I think you must have misunderstood my application requirements. I need to achieve something very similar to what is presented here: http://zone.ni.com/devzone/cda/epd/p/id/6130 . From my limited understanding of the 6115 DAQ hardware I think it should be possible. I do not wish to retrigger the device, I would like to use the output of the trigger circuitry as a clock which is generated from an analog signal, generated from a swept laser interferometer. Thanks,
-Chris
10-15-2013 12:45 PM
Chris,
thanks for the clarification. It seems as though you are on the right path. One point of interest is that the Analog Comparison Event is generated anytime an analog edge trigger or window is configured, and is not an explicit input parameter to a prototype. There is an example that is shipped with CVI called Acq-ExtClk.c that shows how to configure aquisition using an external clock.