embedded - Setting Timer interrupt in 8051, getting stuck -
hi trying set overflow timer interrupt on timer 3 of 8051. code getting stuck in interrupt routine. using 2511f32 (wixel)
here interrupt setting code:
{ ......
t3ctl |= 0xe0; // set prescaler tick frequency / 128 (div) bits 7:5 t3ctl |= 0x04; // clear counter value (clr - bit 2) t3ctl |= 0x00; // timer mode set free running (00) bits 1:0 t3ctl |= 0x08; // enable overflow interrupt (ovfim) bit 3 t3cctl1 &= ~0x40; // disable timer compare interrupts t3cctl0 &= ~0x40; // disable timer compare interrupts ien1 |= 0x08; // enable timer 2 interrupts t3ctl |= 0x10; // start timer (start - bit 4) en = 1; ......
}
here's interrupt routine code
isr(t3,0) { timif &= ~0x07; // t3ovfif clear t3 overflow interrupt flag - bit 0 led_yellow_toggle(); }
it remains trapped in isr routine. there no other interrupt flags clear. ideas ?
how code stuck in isr? if led toggling interrupt enabled time , isr called finishes. never returns main code..
embedded 8051 interrupt sdcc
No comments:
Post a Comment