PIC32MX: Inverse FFT

From Mech
Revision as of 13:18, 18 April 2010 by AndrewDai (talk | contribs)
Jump to navigationJump to search

Overview

An inverse FFT is a function that converts a frequency domain signal into a time domain signal. Inverse FFTs actually use the same algorithm as FFTs except with some scaling and conjugation or time reversal (depending on the algorithm). FFT information can be found at PIC32MX: FFT of Analog Input. The following circuit and code implements a program on the PIC32 that creates an analog signal, takes the FFT of that signal, and then takes the inverse FFT of the result to try and obtain the original waveform back. The data is all sent to MATLAB via RS232 and compared to MATLAB's computational results for accuracy.

The code for both MATLAB and the PIC32 can be found at the bottom of the page or downloaded here.

Circuit

Much of this circuit is the same as the one found in the PIC32MX: FFT of Analog Input page. Here is a recap:

"Beyond simple inputs and outputs, there is no special circuitry required for computing FFTs. The signal is inserted into pin B4 on the PIC and must be below VREF on the PIC (currently configured to 3.3 V). For data output, the PIC uses RS-232 communication. Three connections need to be made with the RS-232:

   * RS-232 Tx to pin F4 on the PIC (orange connection in diagram)
   * RS-232 Rx to pin F5 on the PIC (yellow connection in diagram)
   * Black RS-232 wire to ground 

The remaining connection is not essential for FFT caclulation but allows the user to monitor the calculation time. Pin A14 goes high during calculation and goes back low when the calculation is completed. This feature lets the calculation time be monitored on an oscilloscope.

The following circuit diagram illustrates the signal generator to PIC connection, the RS-232 connections, and the optional oscilloscope connection."

The only thing different about this circuit is that it includes a low pass filter. This filter integrates the PWM signal that is output from pin D0 and creates a continuous, analog signal.

IFftSchematic.png

Example Plot

Much of this circuit is the same as the one found in the PIC32MX: FFT of Analog Input page. Here is a recap: