I can't not enter timer0 interrupt code in IAR simulator

Status
Not open for further replies.

hero0765

Member level 2
Joined
Sep 15, 2008
Messages
52
Helped
2
Reputation
4
Reaction score
2
Trophy points
1,288
Location
China
Activity points
1,605
hi:
my simulator object is Atmega8 and my code below:

#include<iom8.h>

#define __enable_interrupt() SREG |= 0X80;
#define __disable_interrupt() SREG &= 0X7F;

#pragma vector= TIMER0_OVF_vect
//timer overflow function, name doesn't matter.
__interrupt void timer_overflow(void)

{
//LED toggle
PORTB ^= 1 << 3;

}

int main( void )
{
SP = 0x45F;

TCCR0 = 0x00; // normal operation (mode0);
TCNT0=0x0000; // 8it counter register
TCCR0 = 0x05; // start timer/ set clock/ prescalaer - 1024
TIMSK=0x01; // enabled timer overflow interrupt;

DDRB=0x08;
//global interrupts are enabled,
__enable_interrupt();
while (1) {

}
}


I set a breakpoint in the interrupt code ,but the IAR simulator always run and not stop at the breakpoint.why?
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…