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:peter.betts@NOKIA.COM] wrote: > Phil, > > > Example: set CAP1 to gather timer1 count each rising edge. > > Let timer1 free > > run. > > Sorry for being dumb but this means at the internal clock rate, no > prescaler. i.e. timer1 increments every 4th clock cycle? Yes? > > > > Use timer2 set to overflow at a count of say 250 and an > > interrupt on > > overflow. > > Doh! I must have missed that. I didn't know you could set where the overflow > would occur, I've been assuming it was always on 255->256 count! Hows that > done then? > > > >That means you'll be sampling your "captured" > > signal every 1/4 ms > > (250 useconds - assuming a 4 Mhz xtal). A signal of 2000 kHz > > would have a > > count of 500 (plus or minus roughly one by jitter). > > So run a 16bit counter/storage to get so decent resolution. > > I've included my PIC code in another reply to this posting so maybe you can > 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 the > archives :-) > > Pete