Hello!
Be aware that most of the FFT.c you find on the net are general purpose code,
written using float or double numbers. It also calls sin() and cos(). If you run
this on a microcontroller, you get the worst you can imagine in terms of
efficiency.
If you want it to run fast on a microcontroller:
1. Make sure it uses integers or fixed-point multiplications. If not, transform the
code to use integers;
2. Make sure it uses a predefined sin table. If not, make a sine table from
0 to 3π/2;
3. Use a fast multiplier if any. I have implemented it on MSP430 using the
32 bit hardware multiplier. Just for info: one float * float multiplication takes
about 300 clocks. One 16bit * 16bit multiplication takes 7 clocks (if I remember
correctly) on MSP430.
Here is an FFT implementation:
**broken link removed**
It shows the effect of the mechanical parameters on frequency distribution.
The spectrum is normalized, which explains why there is so much noise when
the signal is weak.
The width of the display is 128. I have used a 256 samples FFT, but the power
spectrum is symmetric, so I display only the first half of it.
As the sampling frequency is around 1000 Hz, there are only 4 FFTs every
second. This is why it does not look very responsive, but it is actually very fast.
Dora.