2011-05-11 04:02 PM
Simply count pulses on TIM1?
2011-05-17 05:34 AM
It's simpler than you think. Just increment a variable in the TIM1 IRQ Handler for each CH1 interrupt.
RM0008 the All Densities Reference Manual Section 8 has a complete description of how to configure pins. Table 19 defines the configuration needed for TIM1 pins. Cheers, Hal2011-05-17 05:34 AM
I failed to mention that I need to count pulses at rates up to 1 MHz. That's way faster then an interrupt can handle. My application is this:
Every one second, record the pulse count and then reset it. Pulse count can range from 0 to 1e6 pulses per second. Any additional help? JJS2011-05-17 05:34 AM
2011-05-17 05:34 AM
Consider also that the counter is only 16-bit, so you'll need to increase your sample rate, or cascade the counter.
If the 1PPS has any precision to it, I'd be tempted to use a free running 32-bit counter off the 1 MHz, and latch it to a buffer every second, so as not to accumulate error.