Code:
#include <htc.h>
__CONFIG(INTIO & WDTDIS & PWRTEN & MCLREN & UNPROTECT & DUNPROTECT & BORDIS & IESODIS & FCMDIS & LVPDIS);
void main()
{
ANSEL = 0;
ANSELH = 0;
TRISE1 = 0;
TMR1L = 0;
TMR1H = 0x80;
T1CON = 0x0F; //External Clock 32.768Khz
TMR1IF = 0; //clear t1 interrupt
TMR1IE = 1;
PEIE = 1; //enable interrupts peripral
GIE = 1; //enable gloabal interrupts
while(1);
}
void interrupt isr(){
if(TMR1IF && TMR1IE){
TMR1IF = 0;
TMR1L = 0;
TMR1H = 0x80;
PORTE ^= 2;
}
}
e cám ơn .!

Comment