Hi, some advices: 1. I guess you should choose a greater PIC. AFAIK I have seen an ANxxx containing a FFT for 17C42 definitely. Maybe there is meanwhile for the 16C family (16C74 I guess). Look at www.microchip.com Application Notes. 2. It is important to fix two things before starting an FFT application: 2.1: fmax = 1 / (2 * delta_t) where delta_t is the time between two samples. For a PIC, it must be sufficient do finish all computations "on the fly". That's why a high-speed (20MHz) PIC is recommended. 2.2: spectral resolution. delta_f = 1 / t_sample where t_sample = N * delta_t where N is the number of samples. It is wise so determine N and delta_t that they fullfill the particular goal of your analysis. 3. The original FFT (which is far simpler than other ones) uses the fact, that N = 2 ^ k (k is a positive integer). 4. If you have an a priori information which frequencies are to be expected, it is important so determine the parameters mentioned above that l * delta_f equals to the most of that frequencies otherwise the quality of the analysis will degrade (this is the so called leakage error). [l above is another positive integer.] 5. If you suspect that your input signal contains also higher frequency components than you fmax determined in 2.1 above, it is advised to pre-filter the input data with a lowpass filter. Microchip offers some good literature: AN699 can be used as a starting point. 6. Memory can be a concern. Either an I2C serial RAM (PCF8570 or whatever) can be used, or a parallel RAM (I use 6164). 7. FFT uses some complicated transcendental function. The can be realized with tables only. Another problem is the lack of floating point arithmetic, but a good workaround is a so-called Integer FFT. I hope this helps shomehow. Regards, Imre PS: I'm working on my PhD theses. Of course, the subject is FFT, especially, how to eliminate the leakage error. On Mon, 30 Aug 1999, MILTON MEDICINTEKNIK KB wrote: > Hello everyone out there , > > Is it my turn now? I have been on this list for a few months; find it very interesting, and have learnt a lot. I also hope I have added a few cents worth... > > Competence is very high amongst contribituors, and I guess the following issue can be solved - or already have been solved by a few of you: A suggestion for approoach would be appreciated: > > I would like to measure the frequency of signals in the 1 -- 20 Hz range, not using a DSP or anything other that the already engaged PIC 16C711. It uses a timer interrupt routine, that is it idles most of the time, but every millisecond it jumps out of the loop and polls the AD RES. The A/D is of course picking up the low freq. "AC" (actually 0 -- 5V) to be measured. > > My idea was to see on each sample if the previous sample was smaller. If so, the voltage is ascending. When descending (implementing 3 bits of noice reducing "backlash") I have found a point in time when the peak was found. Correspondingly, I find the "valley". The idŽa is based on a counter that is stepped up every ms, and is used to measure the time between peaks and valleys. In other words, if there are 100 counts between a valley and a peak, we have ¸ wavelength being 100 ms long. 5Hz - right ? > > I have 20 registers. If the frequency is 1.5 -- 2.5 Hz, I add one to the "2 Hz register". If the frequency is 18.5 -- 19.5 Hz, I call it 19Hz. After a few seconds of measurement, I should have a handfull of values in the registers, to correspond to the frequency components of the signal. > > This should work for pretty and clear sinewaves. But these signals are actually noisy with - for instance - long "flats" to consider, when finding a correct point in time. Actually the signal can be considered a random pink noice. > > The signal is in other words a bit complex for finding frequency components in a FFT-type fashion. If it is 5 Hz with a dent in it, it is maybe 80 % 5 Hz, 15 % 15 Hz . . so to speak. This is not imortant in detail. I would like to know that the base is 5 Hz. > > Now to the problem. It doesn't __ work. Am I too optimistic ? Should I realize that a PC or a DSP of some quick sort is needed for this? Am I better off "zero cross-detecting" at 2.5 Volts? > > So - the question is - has anyone been walking this path before ? Am I on the right track ? > > Sven > >