Counting 50 to 200 KHz pulses with TMPn on DZ60

Discussion created by Francois on Jun 1, 2010
Latest reply on Jun 1, 2010 by Francois



I'm quite new with DZ60 and I need to measure the frequency of  a 50 to 200 kHz square wave signal.


My first idea was to use TPM2CH0, and to mesure the number of clock cycles between 2 rising edges

of my signal. It works but there are a lot of interrupts (at each rising edge) and it slows down significantely

my application.


My second idea is to measure the number of pulses in a 250 ms interval.

but I'm unable to configure the TPM2 timer in this way ?

For instance, I've tried to configure :

TPM2SC = 0x18;

TPM2C0SC = 0x04;


But the TPM2C0V counter doesn't increase ?


Could someone indicates me if it's possible to count automatiquely incomming pulses ?

What should I program for these 2 configuration registers ?


Thank you very much for your help