On Sun, 1 Sep 2002, Lars Th=F6rnqvist wrote: > I=92m trying to measure a frequency created from an RC oscillator using= a > 16F877. My problem is that my program takes to long to "find" the > frequency, and it never stabilizes even though the input signal is > constant. How fast does it need to find the frequency? And how are you trying to d= o it now? > Have anyone done this before using CCS or any other C-compiler? > > Any idea how to do this? Right now I=92m trying to calculate amount of > interrupts I get during a specified time period (Using built in > timer)... but as I said... It never stabilizes well enough. I have done this as part of a project in which I needed to determine the speed of a rotating motor by the output of a tachometer-like device. I used the tach pulses as input to CCP1 and used the CCP1 interrupt to read TIMER1 to get the period between pulses. I then used a software filter t= o smooth and stabilize the readings: #int_CCP1 void CCP1_int() { set_timer1(0); accumulator -=3D accumulator/8; accumulator +=3D CCP_1/8; } Hope this helps. Dale -- http://www.piclist.com hint: The PICList is archived three different ways. See http://www.piclist.com/#archives for details.