Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

FFT on dsPIC ADC Values

Status
Not open for further replies.

krazy

New Member
Does anyone have any sample code for this?

I am trying to perform FFT on dsPIC ADC input and don't know where to begin. :confused:

Thank you.
 
Thanks for that. I'm browsing it thru it now....

For the record, I am trying to perform a FFT on the ADC buffer data to extract beats from music. I'm hoping this shouldn't be too hard...
 
Also, does anyone have any idea what twiddle factors are? I can't find any simplified explanations of it off hand.
 
Yeah I didn't understand that :\

What are some instances/examples of common 'trigonometic coefficients'? In what context is this meaningful?
 
Last edited:
If i remember correctly, part of the process of doing the FFT involves multiplying the data by a series of constants. These constants are called Twiddle Factors.

When doing an FFT on a uC, you can pre-calculate these factors instead of having to calculate them every time.
 
You don't need to know about twiddle factors or coefficients to run an FFT. Microchip has a free library for many of the common DSP tasks. Just call the appropriate function.

FFT is in: **broken link removed**

Whole bunch of other libraries: **broken link removed**
 
Ah that makes sense!

My only problem with that is exactly what context they are used. They seem to be pretty specific to some kind of generalized formula, I'd imagine ('trigonometric coefficients'). I guess I just need to see that formula so I can understand what they are, are supposed to be, and how I can use them for fun and profit. :)
 
You don't need to know about twiddle factors or coefficients to run an FFT. Microchip has a free library for many of the common DSP tasks. Just call the appropriate function.

FFT is in: **broken link removed**

Whole bunch of other libraries: **broken link removed**

dougy... one of the arguments for the built in FFT functions is the twiddle factors, though?
 
Whether you want to understand what they are is up to you, you can generate them with the following line or use a lookup table in program memory (table available in link following).
Code:
TwidFactorInit (LOG2_BLOCK_LENGTH, &twiddleFactors[0], 0);	/* We need to do this only once at start-up */

Have a look at some of their example code (e.g. https://ww1.microchip.com/downloads/en/DeviceDoc/CE018_FFT_DSPlib_101007.zip). You can use the above function to create them in RAM, or you could have them defined in program memory (see twiddleFactors.c in the above .zip).
 
Whether you want to understand what they are is up to you, you can generate them with the following line or use a lookup table in program memory (table available in link following).
Code:
TwidFactorInit (LOG2_BLOCK_LENGTH, &twiddleFactors[0], 0);	/* We need to do this only once at start-up */

Have a look at some of their example code (e.g. https://ww1.microchip.com/downloads/en/DeviceDoc/CE018_FFT_DSPlib_101007.zip). You can use the above function to create them in RAM, or you could have them defined in program memory (see twiddleFactors.c in the above .zip).

D'oh!

After looking through exactly that code for the past few hours, I thought TwidFactorInit was simply a function written to abstract the twiddle factor array load into the appropriate memory spots. I didn't realize it was an actual generate function.

Great! Thanks for the help!
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top