Difference between revisions of "PIC32MX: FFT of Analog Input"

From Mech
Jump to navigationJump to search
Line 11: Line 11:
== Circuit ==
== Circuit ==


Beyond simple inputs and outputs, there is no special circuitry required for computing FFTs. The signal input is inserted into pin B4 on the PIC and MUST BE BELOW 3.3 VOLTS. For data output, the PIC uses RS-232 communication. Three connections need to be made with the RS-232:
Include a schematic and give any part numbers. A photo of your circuit is OK, but not as a replacement for a schematic.

*Orange RS-232 wire to pin F4 on the PIC
*Yellow RS-232 wire to pin F5 on the PIC
*Black RS-232 wire to ground

The last 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 otoscope.

The circuit diagram to the right illustrates the signal generator to PIC connection, the RS-232 connections, and the optional otoscope connection.


== Code ==
== Code ==

Revision as of 21:13, 10 February 2010

Original Assignment

Do not erase this section!

Your assignment is to read in several cycles of a periodic signal from a function generator (e.g., a sine wave or a square wave), perform an FFT on your samples using your PIC32, and send back the results to a PC to display. Try this for 256 samples and 1024 samples, and determine how long it takes to compute the FFT for each, once you have collected the data. Verify that the results make sense according to the input signals you've used; for example, a sine wave should have all power at the chosen frequency, while a square wave will have much of the power at the frequency of the wave, but power at other frequencies, too.) Check out the MPLAB C32 Libraries manual to learn more about the dsplib_dsp.h, which you must include. Try both mips_fft16 and mips_fft32.

Overview

Summarize briefly what the page is about.

Circuit

Beyond simple inputs and outputs, there is no special circuitry required for computing FFTs. The signal input is inserted into pin B4 on the PIC and MUST BE BELOW 3.3 VOLTS. For data output, the PIC uses RS-232 communication. Three connections need to be made with the RS-232:

  • Orange RS-232 wire to pin F4 on the PIC
  • Yellow RS-232 wire to pin F5 on the PIC
  • Black RS-232 wire to ground

The last 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 otoscope.

The circuit diagram to the right illustrates the signal generator to PIC connection, the RS-232 connections, and the optional otoscope connection.

Code

Where possible, make it a single piece of well-commented cut-and-pastable code, or at least make each function that way, so others can easily copy it. Most comments should be in the code itself; outside the code (on the wiki) should only be explanatory comments that are too cumbersome to include in the code.