Hi,i need some help with pic tmr0 interrupt. My code is below but it seems that interrupt is not working, tmr0 not increment and it's not working on hardware too.Can anybody help me with that ? May be something wrong with configuration line? My configuration line is ebug_off,CPD_off,LVP_off,BODEN_off,PWRTE_off,WDT_off,HS_osc.
The code:
int cntr=0;
void main()
{
// ADCON1 = 0x00 ;
// TRISA = 0xff ;
INTCON=0b10100000;
OPTION_REG=0;
TMR0=100;
TRISB = 0b00011000;
TRISD = 0b00000000;
PORTB = 0b00011000;
Lcd8_Config(&PORTB,&PORTD,0,2,1,7,6,5,4,3,2,1,0);
LCD8_Cmd(Lcd_CLEAR) ;
for(;
{
Lcd8_Out(1,4,"AUTOMATICS");
if(cntr==10)
{
INTCON=0b00000000;
LCD8_Cmd(Lcd_CLEAR) ;
Lcd8_Out(1,4,"Hello");
Delay_ms(5000);
INTCON=0b10100000;
TMR0=100;
cntr=0;
}
}
}
void interrupt()
{
cntr++;
INTCON=0b10100000;
TMR0=100;
}
The code:
int cntr=0;
void main()
{
// ADCON1 = 0x00 ;
// TRISA = 0xff ;
INTCON=0b10100000;
OPTION_REG=0;
TMR0=100;
TRISB = 0b00011000;
TRISD = 0b00000000;
PORTB = 0b00011000;
Lcd8_Config(&PORTB,&PORTD,0,2,1,7,6,5,4,3,2,1,0);
LCD8_Cmd(Lcd_CLEAR) ;
for(;
{
Lcd8_Out(1,4,"AUTOMATICS");
if(cntr==10)
{
INTCON=0b00000000;
LCD8_Cmd(Lcd_CLEAR) ;
Lcd8_Out(1,4,"Hello");
Delay_ms(5000);
INTCON=0b10100000;
TMR0=100;
cntr=0;
}
}
}
void interrupt()
{
cntr++;
INTCON=0b10100000;
TMR0=100;
}