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

PIC18F4520 clock/osc questions

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



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Mon Feb 05, 2007 5:51 pm     Reply with quote

I don't have an 18F4520 to test, but I believe the following fuse
settings will put it into 4x PLL mode with an external 10 MHz
crystal or oscillator.
Code:

#include <18F4520.h>
#fuses H4, NOWDT, PUT, BROWNOUT, NOLVP
#use delay(clock=40000000)   

//====================================
void main()
{

 
while(1);
}
Frosty
Guest







PostPosted: Mon Feb 05, 2007 5:55 pm     Reply with quote

Yes indeed. The H4 makes all the difference. Thank you.
neverlog



Joined: 02 May 2010
Posts: 36

View user's profile Send private message

PostPosted: Thu Jul 22, 2010 10:13 pm     Reply with quote

Frosty wrote:
Yes indeed. The H4 makes all the difference. Thank you.


I have tested with 10Mhz Crystal + H4, Delay Clock =40Mhz, but seems like the same speed like 20Mhz crystal alone(Delay Clock =20Mhz).

I wonder someone did test it out. For me no different at all.

Feel free to comments
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Thu Jul 22, 2010 10:16 pm     Reply with quote

Are you using an 18F4520 ? And what compiler version ?
neverlog



Joined: 02 May 2010
Posts: 36

View user's profile Send private message

PostPosted: Fri Jul 23, 2010 2:36 am     Reply with quote

PCM programmer wrote:
Are you using an 18F4520 ? And what compiler version ?


Yes. I am using 18F4520, my compiler is 4.104.

I am testing the for loop with fix loop value let say 2048 round.

I found that the time the PIC need to finish the loop is same for (H4, 10Mhz) and (20Mhz alone).

Not much different.
Ttelmah



Joined: 11 Mar 2010
Posts: 19518

View user's profile Send private message

PostPosted: Fri Jul 23, 2010 4:13 am     Reply with quote

You do realise, that if your loop contains a delay (*as shown in your example), the delay _will_ remain the same length, with each different oscillator setting?. The whole 'point' of the clock statement, is that that the compiler then knows how to adjust the internal loops used, to give the same time.

Best Wishes
neverlog



Joined: 02 May 2010
Posts: 36

View user's profile Send private message

PostPosted: Sat Jul 24, 2010 3:40 am     Reply with quote

Ttelmah wrote:
You do realise, that if your loop contains a delay (*as shown in your example), the delay _will_ remain the same length, with each different oscillator setting?. The whole 'point' of the clock statement, is that that the compiler then knows how to adjust the internal loops used, to give the same time.

Best Wishes


Hi Ttelmah, that is not my example code.

I didn't post my code. It's just as simple code with loop for comparing 2048 records in the 24LC256 memory module.

Perhaps reading and compare data from 24LC256 already has limit itself.
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