(MCU M68HC08) MC68HC908JB8 >> Assembly

LED


參考資訊:
1. asmlnk
2. hcs08rmv1
3. funwith08
4. mc68hc908jb8
5. blink-with-sdas

DDRA


PTA


main.asm

    PTA  .equ 0x00
    DDRA .equ 0x04

    .module main
    .optsdcc -mhc08

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

    .area cseg (abs, code)
    .org 0xdc00

main:
    lda #0x02
    sta DDRA

loop:
    eor #0x02
    sta PTA

    ldhx #0xffff
d0:
    aix #-1
    cphx #0x0000
    bne d0

    jmp loop

Makefile

all:
	sdas6808 -los main.asm
	sdld -s main

flash:
	bl08 -c /dev/ttyUSB0 -b 9600 -t jb8 -x 12 -f -g reset main.s19

clean:
	rm -rf main.lst  main.rel  main.s19  main.sym

連接好UART並且按下Reset


編譯、燒錄

$ make
    sdas6808 -los main.asm
    sdld -s main
    ASlink >> -s
    ASlink >> main

$ make flash
    bl08 -c /dev/ttyUSB0 -b 9600 -t jb8 -x 12 -f -g reset main.s19
    bl08 - MC68HC908 Bootloader - version 1.0.0.0
    Reading S-records
    Line ignored: S9030000FC

    S-record data address 00FFFE size 000002
    S-record data address 00DC00 size 000017

    Mass erase
    Program FFFE - FFFF .
    Program DC00 - DC16 .
    Execute code from DC00

完成


返回上一頁