Datasheet
63
8011Q–AVR–02/2013
ATmega164P/324P/644P
When the BOOTRST Fuse is unprogrammed, the Boot section size set to 8 Kbytes and the
IVSEL bit in the MCUCR Register is set before any interrupts are enabled, the most typical and
general program setup for the Reset and Interrupt Vector Addresses is:
Address Labels Code Comments
0x00000 RESET: ldi r16,high(RAMEND); Main program start
0x00001 out SPH,r16 ; Set Stack Pointer to top of RAM
0x00002 ldi r16,low(RAMEND)
0x00003 out SPL,r16
0x00004 sei ; Enable interrupts
0x00005 <instr> xxx
;
.org 0x1F002
0x1F002 jmp EXT_INT0 ; IRQ0 Handler
0x1F004 jmp EXT_INT1 ; IRQ1 Handler
... ... ... ;
0x1FO36 jmp SPM_RDY ; SPM Ready Handler
When the BOOTRST Fuse is programmed and the Boot section size set to 8 Kbytes, the most
typical and general program setup for the Reset and Interrupt Vector Addresses is:
Address Labels Code Comments
.org 0x0002
0x00002 jmp EXT_INT0 ; IRQ0 Handler
0x0022 jmp TIM0_COMPB ; Timer0 CompareB
0x0024 jmp TIM0_OVF ; Timer0 Overflow
0x0026 jmp SPI_STC ; SPI Transfer Complete
0x0028 jmp USART0_RXC ; USART0 RX Complete
0x002A jmp USART0_UDRE ; USART0,UDR Empty
0x002C jmp USART0_TXC ; USART0 TX Complete
0x002E jmp ANA_COMP ; Analog Comparator
0x0030 jmp ADC ; ADC Conversion Complete
0x0032 jmp EE_RDY ; EEPROM Ready
0x0034 jmp TWI ; 2-wire Serial
0x0036 jmp SPM_RDY ; SPM Ready
0x0038 jmp USART1_RXC ; USART1 RX Complete
0x003A jmp USART1_UDRE ; USART1,UDR Empty
0x003C jmp USART1_TXC ; USART1 TX Complete
;
0x003E RESET: ldi r16,
high(RAMEND)
; Main program start
0x003F out SPH,r16 ; Set Stack Pointer to
top of RAM
0x0040 ldi r16,
low(RAMEND)
0x0041 out SPL,r16
0x0042 sei ; Enable interrupts
0x0043 <instr> xxx
... ... ... ...