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

Pic18f4520 Timer1 doesn't work with external clock!

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



Joined: 03 Dec 2008
Posts: 45

View user's profile Send private message

Pic18f4520 Timer1 doesn't work with external clock!
PostPosted: Tue Jun 22, 2010 4:00 pm     Reply with quote

I used PIC18f4520 and want to make a Real time clock using external clock. That is a 32.768K crystal sit on the pin 15 and pin 16.
The configuration for timer1 is like this
Code:

setup_timer_1(t1_external);
set_timer1(0x00);//around 1s
enable_interrupts(int_timer1);
enable_interrupts(global);

but it doesn't work. Because I monitored Timer1 register, use get_timer1(); it always =0.

Then I try another way to use internal clock.
Code:
setup_timer_1(t1_internal);
set_timer1(0xbdb);//62.5ms
enable_interrupts(int_timer1);
enable_interrupts(global);

It works.

Do you know what is the problem when I setup to external clock?
Thanks for your response.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Tue Jun 22, 2010 4:27 pm     Reply with quote

This post shows how to setup Timer1 to use an external 32.768 KHz crystal:
http://www.ccsinfo.com/forum/viewtopic.php?t=25824&start=7
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