karthickiw
Joined: 09 Aug 2007 Posts: 82 Location: TN, India
|
how to setup WDT for this program (12F675) |
Posted: Tue Feb 26, 2008 11:07 pm |
|
|
hello,
how to setup the WDT for below program...
Code: | #include <12F675.h>
#device adc=8
#use delay(clock=4000000)
#fuses NOWDT,INTRC_IO, CPD, PROTECT, NOMCLR, PUT, BROWNOUT
#byte OSCCAL=0x90
#define GP0 PIN_A0
#define GP1 PIN_A1
#define GP2 PIN_A2
#define GP3 PIN_A3
#define GP4 PIN_A4
#define GP5 PIN_A5
//========================
#use fast_io(a)
#byte ADCON0 = 0x1F
#byte ANSEL = 0x9F
#byte CMCON = 0x19
#rom 0x3ff = {0x3470} // input the calibration code
int rtcc=0,seconds=0;
#int_RTCC
RTCC_isr()
{
rtcc++;
if (rtcc == 250)
{
seconds++;
rtcc=0;
}
if (seconds==5)
{
output_HIGH(GP0);
seconds=0;
}
}
void main()
{
ADCON0 = 0; // ADC off
ANSEL = 0; // GPIO pins 0,1,2 and 4 set to all digital
CMCON = 7; // Comparators off
set_timer0(0);
setup_timer_0(RTCC_INTERNAL|RTCC_8_BIT|RTCC_DIV_16);
enable_interrupts(INT_RTCC);
enable_interrupts(GLOBAL);
set_tris_a(0b111110); //GP0 output
output_low(GP0);
while(1) {
}
} |
|
|