>
> Yes, the 16F876 can do this because it as a CCP module. The capture feature
> is well suited to measuring the period of a pulse train. I've done these
> kind of tachometer applications a number of times using CCP modules in
> capture mode.
>
> The trickiest part is dealing with long periods that exceed the 16 bit timer
> 1 wrap period. You have to sample timer 1 more often than it could possibly
> wrap. When you do this, you accumulate an additional delta since the last
> pulse in a separate variable, then reset your saved timer 1 start value for
> this interval. When the capture happens, subtract the saved timer 1 start
> value and add the accumulated delta. Now you've got the period which you
> can use directly or invert to get the frequency.
>
> That's the basic strategy, but there are lots of details to work out, and
> some shortcuts. For example, you don't really need to sample both bytes of
> timer 1 when just compensating for wrap arounds. The high byte is enough,
> but you have to think carefully about how your saved start time is adjusted.
> Also keep in mind that if you do an unsigned subtract of a new timer value
> minus an old value, you get the positive delta regardless of whether the
> number wrapped in between - as long as there weren't more than 65535
> ticks.
>
>
> *****************************************************************
> Olin Lathrop, embedded systems consultant in Devens Massachusetts
> (978) 772-3129,
.....olinKILLspam
@spam@cognivis.com, http://www.cognivis.com
>
> --
>
http://www.piclist.com hint: The list server can filter out subtopics
> (like ads or off topics) for you. See
http://www.piclist.com/#topics