- Main Page
- Modules
- Data Structures
- Files
- Directories

# FFT

## Files
file | e_fft.c
| Package to mange the FFT.

file | e_fft.h
| Package to mange the FFT.

file | e_fft_utilities.h
| Some fft features.

file | e_input_signal.c
| Allocate memory and initialize the sigCmpx array.

file | e_twiddle_factors.c
| The FFT factor from Microchip.

## Detailed Description

## Introduction

The fast fourier transform (FFT) is really usefull, especially to work with the microphones data. This package contains all you need to perform the FFT.
The dsPic has some specials instructions (MAC instructions) which are used here.

## How it works

To do the FFT on your data, first make this:

- choose the size of the array in which the FFT will be done. You have to choose one of the following values: 64, 128, 256 or 512.
- put your choice in the FFT_BLOCK_LENGTH (it's in the file e_fft.h).

Then you just have

- to copy your data in the sigCmpx array with the e_fast_copy(int* in_array, int* out_array, int size) function
- to call the e_doFFT_asm(fractcomplex* sigCmpx) function

A little code to illustrate this.

            e_ad_scan_on();
            // waiting all the 512 data (here we scan the microphones)
     while(!e_ad_is_array_filled());
            e_ad_scan_off();

            // We put the mean to zero
            e_subtract_mean(e_mic_scan[0], FFT_BLOCK_LENGTH, LOG2_BLOCK_LENGTH);
            // We copy the array of micro zero to the FFT array
            e_fast_copy(e_mic_scan[0], (int*)sigCmpx, FFT_BLOCK_LENGTH);

            // The result is saved => we can launch a new acquisition
            e_ad_scan_on();
            // Now we are doing the FFT
            e_doFFT_asm(sigCmpx);

Author:
  Doc: Jonathan Besuchet