Watchdog timer keeps expiring

khansaab

New Member
Hello there,

Device: PIC18F452
Compiler: MPLAB C18
Language: C
Simulator: Proteus
Code description: To toggle LED's at port B at every second using delays library of the compiler
Problem:
1. The simulator keeps generating message that "Processor has been reset by watchdog timer expiring at xyz time". However I have disabled the watchdog timer in configuration bits.
2. The delay has been programed to be of 1s, but its never 1 s. Can somebody please help me with this. Following is the code.


#include <p18f452.h>
#include "delays.h"

void delay1ms(void){
Delay1KTCYx(4);
}

int i;

void main(void){

TRISB = 0x00;
PORTB = 0xAA;
while(1){
PORTB = ~PORTB;
for(i=0; i<=999; i++){}
delay1ms();
}
}

P.S. External clock is of 10Mhz and internal PLL is enabled making it 40 Mhz.
 
Double check that you've actually disabled the WDT, the code posted wouldn't affect it that I can see.
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…