CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

Why FFT.h do not compile on 18F?

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
matheuslps



Joined: 29 Sep 2010
Posts: 73
Location: Brazil

View user's profile Send private message MSN Messenger

Why FFT.h do not compile on 18F?
PostPosted: Sat Nov 30, 2013 9:11 pm     Reply with quote

I tried to do a simple test with the FFT.H and it is returning a EXPECTING AN OPCODE MNEMONIC error on the FFT.H file when the asm file begins.

I tried with the 18F4550 and the 18F25K20.

http://i.imgur.com/XtnSxSW.png

Compiler 5.013
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Sat Nov 30, 2013 10:38 pm     Reply with quote

fft.h is an include file in FFT_filter.c, which is an include file in:
Quote:
c:\program files\picc\examples\ex_fft_filter.c

Here's the first part of that example file:
Quote:
#include <33fj128gp706.h>
#fuses HS, PR_PLL, NOWDT
#use delay(crystal=12M, clock=80M) //40 MIPS

/* Define the FFT length and include the FFT_filter library */
#define FFT_LENGTH 256
#include "FFT_filter.c"

The routines are designed for a dsPIC33. They are not general purpose
routines.
matheuslps



Joined: 29 Sep 2010
Posts: 73
Location: Brazil

View user's profile Send private message MSN Messenger

PostPosted: Sun Dec 01, 2013 10:56 am     Reply with quote

HUm..... OK I got the reason.

I tried to reproduce this FFT example but I do not have a 33FJ128GP706 from the example here. I just have a 33FJ32MC202 and a 33FJ32GP202 available. But since I never worked with dsPic, I was having problems with fuses setup.

On the datasheet, it says that this chips has a FRC clock to startup and after a time it will use the external one with PLL to obtain 80Mhz. Too confusion for me. That is because I tried to use the 18F ones.

But thanks again. Problem solved.

bye
Ttelmah



Joined: 11 Mar 2010
Posts: 19535

View user's profile Send private message

PostPosted: Sun Dec 01, 2013 12:06 pm     Reply with quote

Generally, don't worry about the clock rates!...
If you have a crystal in the legitimate input range for the PLL (data sheet), just specify it all in the clock statement. So crystal=xxxMHz, clock=yyyMHz. The compiler will calculate the ratios needed. All of these chips start on FRC. The PLL, has programmable prescale, ratio, and postscale, allowing often dozens of permutations to give particular frequencies, hence it is much easier to let the compiler calculate these. It's one of the things that CCS 'by and large' gets right. Smile

Best Wishes
matheuslps



Joined: 29 Sep 2010
Posts: 73
Location: Brazil

View user's profile Send private message MSN Messenger

PostPosted: Sun Dec 01, 2013 1:12 pm     Reply with quote

Ttelmah wrote:
So crystal=xxxMHz, clock=yyyMHz. The compiler will calculate the ratios needed.


That is a good! My confusion was right there because on 18F chips we have a lot off PLL div fuses to obtain the right 48Mhz for USB operation.

When I opened the .h file for the dsPIC33 chips, I did not find the divs fuses. But now I know why. I can go back to test again.

Thanks.
Ttelmah



Joined: 11 Mar 2010
Posts: 19535

View user's profile Send private message

PostPosted: Sun Dec 01, 2013 3:33 pm     Reply with quote

Most of this is not programmed through the fuses on these. This is one reason 'why' they have to wake up using FRC.
The PLL, is an entire huge block in it's own right. You have programmable division by 2 to 33 from the clock to the PLL. Then programmable multiplication by 2 to 513. Then /2, 4 or 8 after this. So for 80MHz out you would need 160MHz from the PLL (since it allows frequencies between 100, and 200MHz, and this is the only one that would give 80MHz). Then the multiplication could be anything from 20 to 200, so allowing input frequencies between 8MHz, and 0.8MHz, with the division in front allowing clocks going from 1.6MHz, up to the oscillator limits of the chip. Ouch!....

Best Wishes
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group