单片机汇编吧 关注:121贴子:364
  • 3回复贴,共1
ORG 0000H
JMP START
start_key EQU P2^3
reset_key EQU P2^6
led_port EQU P1
;//////////////////////////////////////
START: MOV R4,#0FFH
MOV R5,#08
CLR C
JB start_key, start
LCALL DELAY2
JB start_key, start
JNB START_KEY,$
L1: MOV A,R4
RLC A
MOV LED_PORT,A
MOV R4,A
JNB reset_key, stop
LCALL DELAY
DJNZ R5,L1
MOV R5,#07
L2: RRC A
MOV LED_PORT,A
MOV R4,A
JNB reset_key, stop
LCALL DELAY
DJNZ R5,L2
MOV R5,#07
MOV 20H,#00
MOV DPTR,#TAB
L3: MOV A,20H
MOVC A,@A+DPTR
MOV LED_PORT,A
JNB reset_key, stop
LCALL DELAY
INC 20H
DJNZ R5,L3
MOV R4,#0FFH
MOV R5,#08
CLR C
JMP L1
stop: MOV LED_PORT,#0FFH
JMP START
;////////////////////////////////////////
DELAY: MOV R6,#3
DELAY0: MOV R2,#150
DELAY1: MOV R3,#248
DJNZ R3,$
DJNZ R2,DELAY1
DJNZ R6,DELAY0
RET
/////////////////////////////////////////
DELAY2: MOV R7,#20
DELAY3: MOV R1,#248
DJNZ R1,$
DJNZ R7,DELAY3
RET
;///////////////////////////////////////
TAB: DB 07EH,0BDH,0DBH,0E7H,0DBH,0BDH,07EH
END


IP属地:广东1楼2015-09-24 11:17回复
    按启动按键,流水灯就按表里面的模式跑


    IP属地:广东来自iPhone客户端3楼2015-09-25 13:42
    回复
      可以


      IP属地:广东来自iPhone客户端5楼2016-04-07 18:14
      收起回复
        具体要求


        IP属地:广东来自iPhone客户端7楼2016-06-21 23:15
        收起回复