3.2 IAR Interrupt Functions in Assembly Language
In IAR, the interrupt function can be defined as:
NAME TIM0_OVF
#define TIM0_OVF_vect 0x0A
extern timer_0_ovf_handler
COMMON INTVEC(1) ; Code in interrupt vector segment
ORG TIM0_OVF_vect ; Place code at interrupt vector
rjmp timer_0_ovf_handler ; Jump to assembler interrupt function
ENDMOD
NAME TC
PUBLIC timer_0_ovf_handler
RSEG CODE
timer_0_ovf_handler:
;interrupt function content
reti
END
Note: The address after
ORG
should be the absolute byte address of the
interrupt vector. In this example, the word address of
TIM0_OVF
in the ATtiny104 data sheet is 0x005, so
the byte address is 0x005*2 =0x0A.