Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

analog input generating trigger on the counter gate to measure frequency

Hello,

 

I want to measure a frequency on the analog input but it doesn't seem to work.

 

I'm trying to get it working using DAQmx with the use of ansi c.

 

The first step I made was acquiring the information on the analog input. With the use of a simulated device this shows a sine wave on the input.

My next step was to generate a trigger signal for the counter, but this doesn't seem to work.

 

I don't see how it is possible to connect the trigger on the analog input to the counter.

 

For the creation of the analog input and trigger I use the following code:   

    DAQmxErrChk (DAQmxCreateTask("",&taskHandle));
    DAQmxErrChk (DAQmxCreateAIVoltageChan(taskHandle,"Dev1/ai0","",DAQmx_Val_Cfg_Default,-3.0,3.0,DAQmx_Val_Volts,NULL));
    DAQmxErrChk (DAQmxCfgSampClkTiming(taskHandle,"",10000.0,DAQmx_Val_Rising,DAQmx_Val_FiniteSamps,1000));   

    DAQmxErrChk (DAQmxCfgAnlgEdgeStartTrig(taskHandle,"Dev1/ai0",DAQmx_Val_RisingSlope, 0));

 

For the creation of the counter I am using the following code:   

   DAQmxErrChk(DAQmxCreateCIFreqChan(taskHandle1,"Dev1/ctr1", "",1,2000,DAQmx_Val_Hz ,DAQmx_Val_Rising ,DAQmx_Val_LowFreq1Ctr ,1,4,""));

 

I hope some one could give me a hint.

I have also tried the examples that come with DAQmx but far as I know this are only counter examples using digital inputs.

 

Thanks in advance.

 

0 Kudos
Message 1 of 1
(2,880 Views)