You are on page 1of 4

TWDT

Figura 1 Valor tiempo de oscilacin Watch Dog Timer

TWDTMax 128 18m[s] 2.304[s]

Figura 2 Bits asociados al funcionamiento del Watch Dog Timer

//******************** DEFINICION LIBRERIAS*************


#include "int16CXX.H"
#pragma origin 4 // Definicin Vector Interruciones
// Variables Globales
char dato;
int flag;
// ****************** INTERRUPCION **********************
void ret(uns16 r)
{
while(r>0)
{
r-- ;
}
}
void main() // Main
{
// ********************* Led *****************
TRISB.5=0;
PORTB.5=0;

// ************ WatchDog Timer ***************


OPTION_REG.3=1;//PSA
OPTION_REG.2=1;//PS2
OPTION_REG.1=1;
OPTION_REG.0=1;//PS0
clrwdt();
PORTB.5=1 ;
ret(10000);
ret(10000);
ret(10000);
ret(10000); // visualiza cada encendido del PIC
clrwdt();
sleep();
while(1)

{
}

You might also like