微處理器 - NXP MC68HC908JB8 - Assembly - Button



參考資訊:
https://www.sparetimelabs.com/funwith08/funwith08.php
https://www.nxp.com/docs/en/data-sheet/MC68HC908JB8.pdf
https://github.com/ixaxaar/sdcc/blob/master/sdas/doc/asmlnk.txt
https://hackaday.io/project/167952-semyon/log/169905-blink-with-sdas
https://www.nxp.com/files-static/microcontrollers/doc/ref_manual/HCS08RMV1.pdf

PTE


DDRE


配置提昇電阻


main.asm

    PTA  .equ 0x00
    DDRA .equ 0x04
    PTE  .equ 0x08
    DDRE .equ 0x09
    POCR .equ 0x1d

    .module main
    .optsdcc -mhc08

    .area codeivt (abs)
    .org 0xfffe
    .dw main

    .area cseg (abs, code)
    .org 0xdc00
main:
    lda #0x10
    sta POCR

    lda #0x02
    sta DDRA

    lda #0x00
    sta DDRE
loop:
    lda PTE
    lsra
    lsra
    lsra
    sta PTA
    jmp loop

完成