Problem with FFT results (phase) with dsPIC30f6014A

General discussion on mikroC for dsPIC30/33 and PIC24.
Post Reply
Author
Message
dodoletesteur
Posts: 14
Joined: 25 Jan 2009 10:30

Problem with FFT results (phase) with dsPIC30f6014A

#1 Post by dodoletesteur » 04 May 2009 12:47

Hello,

I use the dsPICPRO 4 Development Board and mikroC.

I'm building a program which gets a signal through the ADC, computes a FFT with it and stores the results (Real et Imaginary parts) in the same array.

Thanks to the mikroC library and the function FFT(), I succeed in performing an FFT (1 period, 64 points, resolution: 50Hz), but the results are odd.

The amplitude of each frequency is good, but their phases randomly change, even if I put a test, weel-known signal. I know that it is normal to have a changing phase for the fundamental frequency, but the problem I see is, for instance, that the difference between the phases of the first and the third harmonics always changes, whereas the signal doesn't changes.

It's like there is no phase reference... I really don't understand why! And I really need the phase information in order to make my program work.

Does anyone have an idea?

NB1: I also tried with other FFT parameters (other resolutions, more points) but it was the same.

NB2 : for these experiments, I only use the library provided by MikroE, without any change, except the display of the phases of some frequencies that I get with this formula:

float Phase(float Re, float Im) {
return atan(Im/Re);
}

User avatar
zristic
mikroElektronika team
Posts: 6608
Joined: 03 Aug 2004 12:59
Contact:

Re: Problem with FFT results (phase) with dsPIC30f6014A

#2 Post by zristic » 04 May 2009 12:52

Strange indeed. If you have more info, or you find an answer please let us know.

dodoletesteur
Posts: 14
Joined: 25 Jan 2009 10:30

#3 Post by dodoletesteur » 05 May 2009 09:35

Is it possible to get the source code of the FFT algorithm included in your MikroC library?? I think that there is some trouble with it!

User avatar
zristic
mikroElektronika team
Posts: 6608
Joined: 03 Aug 2004 12:59
Contact:

#4 Post by zristic » 05 May 2009 10:13

The code is entirely written in assembly and it is provided by Microchip. You can find the code in ASM files provided with MPLAB installation.

Post Reply

Return to “mikroC for dsPIC30/33 and PIC24 General”