Faruk Chaudhry

Measuring a known pulse width range with the HCS08

Discussion created by Faruk Chaudhry on Dec 18, 2006
Latest reply on Dec 21, 2006 by bigmac
Hello,
 
Need advice in measuring a pulse which can vary from 100us to 10ms from an ultrasonic sensor.  The difficulty is when the second captured timer value is less than the first (overflow occured) in order to compute the pulse width.  Should the timer be reset after each edge rather than using a free running counter?
 
Ex.
 
First input capture value = 0xFF00
Second input capture value = 0x0060
 
Timer clock = 4MHz
TMOD = 39999 (subtract 1 cycle for overflow)

Outcomes