07-19-2007 03:05 PM
07-20-2007 02:43 PM
Hello Mike,
Below is an excerpt from the DAQmx C Reference Help document. (Start >> All Programs >> National Instruments >> NI-DAQ >> NI-DAQmx C Reference Help)
“Prescaling allows the counter to count a signal that is faster than the maximum timebase of the counter. The TIO counters offer 8X and 2X prescaling on each counter. You can disable prescaling. Each prescaler consists of a small, simple counter that counts to eight (or two) and rolls over. This counter is specifically designed for this application and can count signals that are faster than the general purpose counters. The CtrNsource signal on the general purpose counter is the divided signal from the simple counter.”
You would use the DAQmxGetCIPrescaler function. (int32 __CFUNC DAQmxSetCIPrescaler(TaskHandle taskHandle, const char channel[], uInt32 data);)
You should be able to use this function with the PCI-6602. You are not getting an error? What is the frequency of the signal that you are trying to measure? How do you have your signal connected?
08-01-2007 09:04 AM
08-01-2007 09:06 AM - edited 08-01-2007 09:06 AM
Message Edited by MikeGI on 08-01-2007 10:06 AM
Message Edited by MikeGI on 08-01-2007 10:06 AM
08-01-2007 10:19 AM
I *think* but don't know for sure that the prescalars are only for external signals, not for the internal timebase. Also, while they can be applied to counter "Source" signals, I'm not sure if they can be applied to counter "Gate" or "Sampling Clock" signals. I'm a little surprised that your tests gave you unexpected results but no errors.
Why are you trying to pre-scale the internal timebase? If there's a good reason for it, a workaround is simply to perform a prescaling-like function by generating a clock with one of the counters. You could then divide the internal timebase by any integer >= 4 (both High Ticks and Low Ticks must have a minimum value of 2), and use this counter's output as the timebase for your period measurements.
However, I'm having a tough time thinking of a good reason to pre-scale the internal timebase. Avoiding counter roll-over is about the only reason that occurs to me, and you can almost always achieve that by selecting a slower internal timebase in the first place. The choices are 80 MHz, 20 Mhz, and 100 kHz.
-Kevin P.
08-01-2007 10:45 AM
08-01-2007 12:25 PM
08-01-2007 12:32 PM
08-02-2007 08:25 AM - edited 08-02-2007 08:25 AM
Hi Kevin,
I had a talk with my coworker and we realized our understanding of the prescaler was wrong. Our old Legacy card was able to place a divide ratio on the counter gate signal, which is what we want to achieve with the 6602. The prescaler, though, places the divide ratio on the counter source signal, correct? Is there a way to place a divide ratio on the counter gate signal?
Thanks
Mike
Message Edited by MikeGI on 08-02-2007 09:26 AM
08-02-2007 01:14 PM
Well, yes and no. Kinda like I described earlier, there's a way to get a prescaling-like effect by using an additional counter to perform frequency division. You'd measure periods of of that divide-down counter and could choose any integer divisor >= 4.
I would only see this as a particular advantage if the raw pulse rate were quite high, like at least high 10's of kHz. Otherwise, you're just discarding information.
-Kevin P.