单片机按下按钮A,LED灯亮。按下按钮B,LED灯灭。汇编
答案:1 悬赏:30 手机版
解决时间 2021-03-07 10:09
- 提问者网友:沉默菋噵
- 2021-03-06 13:57
单片机按下按钮A,LED灯亮。按下按钮B,LED灯灭。汇编
最佳答案
- 五星知识达人网友:duile
- 2021-03-06 15:12
key1 equ p1.0
key2 equ p1.1
led equ p1.2
org 0
jmp main
main:
mov sp,#0x70
loop:
jb key1,l1
call DELAY10MS
jb key1,l1
clr led
l1:
jb key2,l2
call delay10ms
jb key2,l2
setb led
l2:
jmp loop
DELAY10MS: ;@11.0592MHz
PUSH 30H
PUSH 31H
MOV 30H,#18
MOV 31H,#230
NEXT:
DJNZ 31H,NEXT
DJNZ 30H,NEXT
POP 31H
POP 30H
RET
key2 equ p1.1
led equ p1.2
org 0
jmp main
main:
mov sp,#0x70
loop:
jb key1,l1
call DELAY10MS
jb key1,l1
clr led
l1:
jb key2,l2
call delay10ms
jb key2,l2
setb led
l2:
jmp loop
DELAY10MS: ;@11.0592MHz
PUSH 30H
PUSH 31H
MOV 30H,#18
MOV 31H,#230
NEXT:
DJNZ 31H,NEXT
DJNZ 30H,NEXT
POP 31H
POP 30H
RET
我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息
大家都在看
推荐资讯