wuchy143
Member
Hi all,
I'm trying to get familiar using a watchdog timer and using the prescalar with it. Background: I'm using the PIC12F675, High Tech C LIte Compiler, and MPSIM which comes with MPLAB IDE. I'm able to get the WDT to go over and halt execution in my simulation. I also see the bit TO in my SFR STATS go to "0" indicating a WDT timeout occured. This event takes the expected 18ms to occur which I verify using the stopwatch in the IDE. Though, when I apply my prescalar to the OPTION_REG it still only does 18ms and not the expected 2.3s(when using a prescalar of 128)(18ms X 128 = 2.3s)
It's as if I'm not assigning the prescalar correctly but in any manuals I read I'm correct. I"m stumped......
Code:
#include <htc.h>
__CONFIG(MCLREN & UNPROTECT & WDTEN & INTIO);
void main()
{
for(;; ) {
CMCON = 0x07; // Digital I/O
ANSEL = 0; // Digital I/O
TRISIO = 0x00000000; // Set Pin I/O
//STATUS = 0x00;
OPTION = 0x00001111; //Enableing Watchdog and setting prescaler to 128 X 18ms = 2.3ms
}
}
I'm trying to get familiar using a watchdog timer and using the prescalar with it. Background: I'm using the PIC12F675, High Tech C LIte Compiler, and MPSIM which comes with MPLAB IDE. I'm able to get the WDT to go over and halt execution in my simulation. I also see the bit TO in my SFR STATS go to "0" indicating a WDT timeout occured. This event takes the expected 18ms to occur which I verify using the stopwatch in the IDE. Though, when I apply my prescalar to the OPTION_REG it still only does 18ms and not the expected 2.3s(when using a prescalar of 128)(18ms X 128 = 2.3s)
It's as if I'm not assigning the prescalar correctly but in any manuals I read I'm correct. I"m stumped......
Code:
#include <htc.h>
__CONFIG(MCLREN & UNPROTECT & WDTEN & INTIO);
void main()
{
for(;; ) {
CMCON = 0x07; // Digital I/O
ANSEL = 0; // Digital I/O
TRISIO = 0x00000000; // Set Pin I/O
//STATUS = 0x00;
OPTION = 0x00001111; //Enableing Watchdog and setting prescaler to 128 X 18ms = 2.3ms
}
}