haroon_tech
Member level 2
hi,
the code i have written to handle timer0 interrupt .but isr is not executing ......what is problem in my code .the compile is Micro C compiler
the code i have written to handle timer0 interrupt .but isr is not executing ......what is problem in my code .the compile is Micro C compiler
Code C - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 void timer_init(void); void interrupt (void) { INTCON.TMR0IF=0; TMR0L=0X00; INTCON.TMR0IE=1; T0CON.TMR0ON=1; } main() { timer_init(); while(1); } void timer_init(void) { INTCON.GIE=1; //globle interrupt enable INTCON.PEIE=1; //peripharel interrupt enable INTCON.TMR0IF=0; //clear the timer0 flag TMR0L=0x00; //timer0 reg with initial count //prescalar value 1:256 T0CON.T0PS0=0; T0CON.T0PS1=0; T0CON.T0PS2=0; T0CON.PSA=0; //prescaler is assigned to timer0 //T0SE=0; T0CON.T0CS=0; T0CON.T08BIT=1; //use internal clock or timer mode INTCON.TMR0IE=1; //enable the timer0 by setting TRM0IE flag T0CON.TMR0ON=1; }
Last edited by a moderator: