Frequency Scaling - remapping
pandersnKILLspam@@email@example.com email (remove spam text)
Right. Say xtal running at 4 Mhz. Then your instruction or "clock" rate
will be 1 Mhz. Timer2 will count once each instruction cycle. Setting a
timer2 at 250 will give you then a 4 kHz rate. Turn off the pre-scalar and
post-scalar, just set 250 in timer2 reg. Enable interrupts for timer2 of
course. Then process your flags at the capture input during each timer2
interrupt - this gives you a constant sampling rate.
You are sampling an event (a flag), so you do NOT have to sample at > twice
the freq content of the input signal (sampling theorem), that is for audio,
not freq measuring!.
Hope that helps. Hey, download (adobe) the Embedded Micro Book from
Microchip's web site. It does a reasonable job of explaining all of the
peripherals, including the timers.
Phil Anderson....have a good day! Go kick a Tae Kwon Do bag!
On Wednesday, June 07, 2000 1:39 AM, Peter Betts
[SMTP:NOKIA.COM] wrote: peter.betts
> would occur, I've been assuming it was always on 255->256 count! Hows
> point out some NOVICE mistakes! Can anyone point me to some example code?
> Excellent help from the list by the way, expecially the maths stuff in
> archives :-)
See also: www.piclist.com/techref/microchip/devices.htm?key=pic
You must be a member of the
piclist mailing list
(not only a www.piclist.com member) to post to the