View previous topic :: View next topic |
Author |
Message |
ktallevi
Joined: 17 Dec 2005 Posts: 58
|
WDT and RTCC ...RTCC delayed start? |
Posted: Tue Jan 02, 2007 12:23 pm |
|
|
Hi, Im using the WDT and RTCC in the same program. It appears that the WDT works fine, but the RTCC takes 6 seconds to start counting upon powering the PIC.(Chip part# is the 18F8722). I assume you cant use the scaler for both the WDT and Timer0/RTCC? If so is there a timer with an independent timer that could resolve the problem? thanks
--
Interupt code, and fuses pasted below...
/* RTCC Interrupt, timer0*/
#int_rtcc
void clock_isr(void) {
if(--int_count==0) {
++seconds;
fprintf(DebugPort,"%U",seconds);
int_count=INTS_PER_SECOND;
}
}
/* configuration */
setup_wdt(WDT_ON);
set_timer0(0);
setup_timer_0(RTCC_INTERNAL|RTCC_DIV_256|RTCC_8_BIT);
enable_interrupts(INT_RTCC);
enable_interrupts(GLOBAL);
/* fuses */
#FUSES WDT32768 |
|
|
ckielstra
Joined: 18 Mar 2004 Posts: 3680 Location: The Netherlands
|
|
Posted: Tue Jan 02, 2007 1:11 pm |
|
|
A startup time of 6 seconds with your initialization is impossible, you have an error in your program somewhere. On program startup, what value do you int_count initialize with?
My guess is you initialize it to 0....
If yes, than your problem is in the line Code: | if(--int_count==0) { |
|
|
|
|