微處理器 - NXP LPC2103 - Assembly - Power-down



參考資料:
https://www.keil.com/dd/docs/datashts/philips/user_manual_lpc2101_2102_2103.pdf

暫存器



main.s

    .equ IODIR,        0xe0028008
    .equ IOCLR,        0xe002800c
    .equ IOSET,        0xe0028004
    .equ PINSEL0,      0xe002c000
    .equ EXTWAKE,      0xe01fc144
    .equ PCON,         0xe01fc0c0
    .equ VICIntEnable, 0xfffff010
 
    .text
    .align 2
    .global _start
_start:    b reset
_undef:    b .
_swi:      b .
_pabort:   b .
_dabort:   b .
_reserved: b .
_irq:      b .
_fiq:      b .
  
reset:
    ldr r0, =PINSEL0
    ldr r1, =(1 << 28)
    str r1, [r0]

    ldr r0, =EXTWAKE
    ldr r1, =0x02
    str r1, [r0]

    ldr r0, =VICIntEnable
    ldr r1, =(1 << 15)
    str r1, [r0]

    ldr r0, =IODIR
    ldr r1, =(1 << 22)
    str r1, [r0]

    ldr r0, =IOCLR
    ldr r1, =(1 << 22)
    str r1, [r0]

    ldr r0, =PCON
    ldr r1, =0x02
    str r1, [r0]

    ldr r0, =IOSET
    ldr r1, =(1 << 22)
    str r1, [r0]
    b .
    .end

完成