微處理器 - Microchip AT91SAM7S64 - Assembly - Button



參考資訊:
https://github.com/dwelch67/sam7s_samples
https://ww1.microchip.com/downloads/en/DeviceDoc/6175s.pdf
https://ww1.microchip.com/downloads/en/DeviceDoc/doc6175.pdf

Enable


Output


Output High


Output Low


Input


main.s

    .equ PMC_PCER, 0xfffffc10
    .equ PIO_PER,  0xfffff400
    .equ PIO_OER,  0xfffff410
    .equ PIO_SODR, 0xfffff430
    .equ PIO_CODR, 0xfffff434
    .equ PIO_PDSR, 0xfffff43c
 
    .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, =PMC_PCER
    ldr r1, =4
    str r1, [r0]

    ldr r0, =PIO_PER
    ldr r1, =0x40000
    str r1, [r0]

    ldr r0, =PIO_OER
    ldr r1, =0x40000
    str r1, [r0]
 
loop:
    ldr r0, =PIO_PDSR
    ldr r1, [r0]
    and r1, #0x20000
    cmp r1, #0
    beq 1f
    ldr r0, =PIO_SODR
    ldr r1, =0x40000
    str r1, [r0]
    b loop
1:
    ldr r0, =PIO_CODR
    ldr r1, =0x40000
    str r1, [r0]
    b loop
    .end

完成