beautypg.com

Reset sources, Atmega163(l) – Rainbow Electronics ATmega163L User Manual

Page 21

background image

ATmega163(L)

21

;

$024

MAIN:

ldi

r16,high(RAMEND); Main program start

$025

out

SPH,r16

; Set stack pointer to top of RAM

$026

ldi

r16,low(RAMEND)

$027

out

SPL,r16

...

...

...

When the BOOTRST fuse is programmed and the boot section size set to 512 bytes, the most typical and general program
setup for the Reset and Interrupt Vector Addresses in ATmega163 is:

Address

Labels

Code

Comments

$002

jmp

EXT_INT0

; IRQ0 Handler

...

...

...

$022

jmp

TWSI

; 2-wire Serial Interface Interrupt Handler

;

$024

MAIN:

ldi

r16,high(RAMEND); Main program start

$025

out

SPH,r16

; Set stack pointer to top of RAM

$026

ldi

r16,low(RAMEND)

$027

out

SPL,r16

$028

xxx

;

.org $1f00

$1f00

jmp

RESET

; Reset Handler

Reset Sources

The ATmega163 has four sources of reset:
• Power-on Reset. The MCU is reset when the supply voltage is below the power-on reset threshold (V

POT

).

• External Reset. The MCU is reset when a low level is present on the RESET pin for more than 500 ns.

• Watchdog Reset. The MCU is reset when the Watchdog timer period expires and the Watchdog is enabled.

• Brown-out Reset. The MCU is reset when the supply voltage V

CC

is below the brown-out reset threshold (V

BOT

).

During reset, all I/O registers are set to their initial values, and the program starts execution from address $000 (unless the
BOOTRST fuse is programmed, as explained above). The instruction placed in this address location must be a JMP -
absolute jump - instruction to the reset handling routine. If the program never enables an interrupt source, the interrupt vec-
tors are not used, and regular program code can be placed at these locations. The circuit diagram in Figure 24 shows the
reset logic. Table 4 and Table 5 define the timing and electrical parameters of the reset circuitry.