Measurement Studio for VC++

cancel
Showing results for 
Search instead for 
Did you mean: 

20MHzTimeBase Src and PFI7 as GATE ? (Gated Couting ?)

I have been looking for some help on this for a bit, but can't seem to find the answers. Basically I need to measure RPM and Pressure using NIDAQmx, I can get read the voltage ch from transdeucer fine. However, I need to use the 20 MHZ CLK as the source, and I want to use The counters at PFI7 and PFI4 as triggers Gates. Encoder counter is hooked up to PFI7 and PFI4. PFI7 used to Gate the src , and PFI4 used for once per revolution. Basically, I am looking for time reference (time Value) from the src clk when I Gate it. I got this code from one of the NI support guys , but it's giving strange numbers in the billions, I am not sure if its connected correctly?
 

DAQmxErrChk (DAQmxCreateCICountEdgesCha(taskHandle,"Dev1/Ctr0","",DAQmx_Val_Rising,0,DAQmx_Val_CountUp));DAQmxErrChk (DAQmxSetCICountEdgesTerm(taskHandle,"Dev1/Ctr0","/Dev1/20MHzTimebase"));

DAQmxErrChk (DAQmxCfgSampClkTiming(taskHandle,"/Dev1/PFI7",1000.0,DAQmx_Val_Rising,DAQmx_Val_ContSamps,1000));

DAQmxErrChk (DAQmxReadCounterU32(taskHandle,100000,10.0,data,1000,&read,NULL));

With this code, sometimes I get "Data is overwritten", but when I do get readings, I am getting crazy numbers, I thought I would be reading time values less than (2^24 -1). ?  Does the code make sense, or what am I doing wrong?

Thanks a lot for your help

0 Kudos
Message 1 of 2
(5,905 Views)
Let's continue with your other forum, here.
David L.
Systems Engineering
National Instruments
0 Kudos
Message 2 of 2
(5,894 Views)