View previous topic :: View next topic |
Author |
Message |
cchappyboy
Joined: 03 Dec 2008 Posts: 45
|
Pic18f4520 Timer1 doesn't work with external clock! |
Posted: Tue Jun 22, 2010 4:00 pm |
|
|
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
|
|
 |
|