io_ctrl.asm

来自「DSP用汇编语言实现对外部IO口控制」· 汇编 代码 · 共 34 行

ASM
34
字号
    .mmregs
    .global main
    .global delay
;============================================================================
.text
main:
;ld #0x0007,A;test for three leds 
;    stlm A,AR1
;   portw AR1,0x0000
;  call delay

loop:ld #0x0001,A;make the first led shine
     stlm A,AR2
     portw AR2,0x0000
     call delay
     ld #0x0002,A;make the second led shine
     stlm A,AR3
     portw AR3,0x0000
     call delay;
     ld #0x0004,A;make the third led shine
     stlm A,AR4
     portw AR4,0x0000
     call delay
     b loop;jump to the beginning of loop
     
delay:st #0x000f,BRC;execute the loop above
     rptb N2nd-1
     rpt 0x000f
     nop
N2nd:ret 
     .end
     
     

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?