Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

mikroc pic16f877a tmr0 help

Status
Not open for further replies.

kta22

New Member
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 :Debug_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;

}
 
Status
Not open for further replies.

New Articles From Microcontroller Tips

Back
Top