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 support@ccsinfo.com

What's the difference between PLL and using a 4x Crystal

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



Joined: 01 Feb 2006
Posts: 64
Location: England

View user's profile Send private message Visit poster's website

What's the difference between PLL and using a 4x Crystal
PostPosted: Wed Jan 24, 2007 5:53 pm     Reply with quote

Hi,

I'm considering using PLL to increase the speed of my computation, RS232 communications. The other option is changing from a 10MHz crystal to a 40MHz.

When using PLL, do I set the entire chip up as though I have a 40MHz crystal or are there some things that are still based on the RAW 10MHz signal Question

Things I think I can already confirm:

* timers are 4 times faster, therefore set up like 40MHz
* UART is 4 times faster, therefore set up like 40MHz
* ADC set up like 40MHz, therefore setup_adc(ADC_CLOCK_DIV_64), rather than setup_adc(ADC_CLOCK_DIV_16);

Hence the question, what's the difference?

Is there anything I should watch out for doing this?

Cheers Scott

PS Reading other posts I've discovered that PLL (#FUSE H4) requires a power cycle to become active, that had me chasing my tail for a while!
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Wed Jan 24, 2007 6:05 pm     Reply with quote

Regarding using a 10 MHz crystal and the PLL to get a 40 MHz clock:
Most things will be taken care of by setting up the #use delay() statement
to specify 40 MHz. The UART library code uses the #use delay() value
to calculate how to setup the baud rate generator. In the case of the
A/D clock, you will have to manually choose the correct constant.
Consult the table in the A/D section of the PIC data sheet to determine
which divisor to use. Every PIC that has an A/D will have this table.

For other issues, you need to specify the PIC. Some PICs, such as the
18F4550, have complex oscillator circuits.
Mark



Joined: 07 Sep 2003
Posts: 2838
Location: Atlanta, GA

View user's profile Send private message Send e-mail

PostPosted: Wed Jan 24, 2007 6:53 pm     Reply with quote

The difference is less EMI from a 10MHz crystal. Also you will need to look at the max crystal speed that can be used. Most are 25MHz. For 40MHz operation, you would need a clock instead of a crystal.
ferrumvir



Joined: 01 Feb 2006
Posts: 64
Location: England

View user's profile Send private message Visit poster's website

PostPosted: Thu Jan 25, 2007 4:20 am     Reply with quote

Thanks,

I'm using two chips, PIC18F452 and PIC18F2580, both can take 40MHz clocks/crystals.

Except changing the "#fuse HS" to "#fuse H4", I can't see any difference in the C source for "10MHz with PLL" or "40MHz clock".

Both use #use delay (40000000) and the constants/registers for the timers/UART/ADC all have to be set up for 40MHz.

Thanks for the info

Cheers Scott
Ttelmah
Guest







PostPosted: Thu Jan 25, 2007 8:30 am     Reply with quote

Whoa.
The 18F452, _cannot_ 'take a 40Mhz crystal'. It can take a 40MHz external clock, but look carefully at able 22.4 in the data sheet. The maximum rated frequency, for 'HS' operation, is _25MHz_...
The same applies with the 2580. Here it is table 27.6 in the data sheet,and again the maximum rated frequency for HS, is 25MHz.
In general, the chips will oscillate with a 40MHz crystal, but if you want reliable operation, across the supply, and temperature range, _keep inside the spec_, and don't do it...

Best Wishes
ferrumvir



Joined: 01 Feb 2006
Posts: 64
Location: England

View user's profile Send private message Visit poster's website

PostPosted: Thu Jan 25, 2007 8:54 am     Reply with quote

Thanks for the info Ttelmah,

I'm sorry for being a little behind on the crystal/clock, I don't know what the difference between a External Clock and (EC) and a crystal (HS)?

If I understand the tables correctly then I can PLL a 10MHz crystal - effectively 40Mhz, or I can use a 40MHz exteranl clock.

Apart from the changes to the #fuse H4 to EC_IO, are there any other programming differences between these two options?

Cheers Scott
Ttelmah
Guest







PostPosted: Thu Jan 25, 2007 8:59 am     Reply with quote

None at all, except that 'EC_IO', gives you an extra I/O pin. Smile

Best Wishes
Mark



Joined: 07 Sep 2003
Posts: 2838
Location: Atlanta, GA

View user's profile Send private message Send e-mail

PostPosted: Thu Jan 25, 2007 9:02 am     Reply with quote

A clock is a TTL or CMOS level oscillator.
ferrumvir



Joined: 01 Feb 2006
Posts: 64
Location: England

View user's profile Send private message Visit poster's website

PostPosted: Thu Jan 25, 2007 3:33 pm     Reply with quote

Thanks,
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