interestingly enough, if you go into the pic's datasheets, you see two ways to count pulses in hardware.
if tyou use something more complicated than the f84, you could use the external clock source for tmr0(0 to FF) or tmr1(0 to FFFF). using this you could count the pulses in a given delay period and get a figure in terms of
pin-oscils/(period) the time base can be multiplied to 1sec.
otherwise you could use the capture feature of the ccp module(which includes the pwm) to measure the amount of internal clock pulses in between every pulse on the pin. this will give an amount in terms of
periods/pin-oscils.
see if you can use either one.
the first is easiest because you just have to multiply for hertz. for the capture module you'd have to invert the fraction for hz.




Bookmarks