實力彰顯!億信華辰入選中國大資料產業一級市場相關廠商圖譜
阿新 • • 發佈:2022-05-11
K1 EQU P2.0;命名
LED EQU P0
ORG 00H
JMP MAIN
ORG 30H
MAIN:
MOV LED,#00H
MOV R0,#0
SETB K1
GO:
MOV A,#10101010H
MOV LED,A
ACALL DELAY
CPL A
MOV LED,A
ACALL DELAY
JNB K1,INCR;k1為0轉移
JMP GO
INCR:
JNB K1,INCR
INC R0
ACALL PLAY
CJNE R0,#6,GO;不相等轉移
SJMP MAIN
PLAY:
MOV R1,#0FFH
MOV A,R0
WY2:CJNE A,#1,WY3
CALL WY12
WY3:CJNE A,#2,WY4
CALL WY13
WY4:CJNE A,#3,WY5
CALL WY14
WY5:CJNE A,#4,WY6
CALL WY15
WY6:CJNE A,#5,WY7
CALL WY16
WY7:RET
;流水燈樣式
WY12:
MOV DPTR,#TAB1
LOOP2:
INC R1
CJNE R1,#9,LKSHOW2
JMP RET2
LKSHOW2:
ACALL SHOW
LCALL DELAY
LCALL DELAY
JMP LOOP2
RET2:RET
WY13:
MOV DPTR,#TAB2
LOOP3:
INC R1
CJNE R1,#9,LKSHOW3
JMP RET3
LKSHOW3:
ACALL SHOW
LCALL DELAY
LCALL DELAY
JMP LOOP3
RET3:RET
WY14:
MOV DPTR,#TAB3
LOOP4:
INC R1
CJNE R1,#9,LKSHOW4
JMP RET4
LKSHOW4:
ACALL SHOW
LCALL DELAY
LCALL DELAY
JMP LOOP4
RET4:RET
WY15:
MOV DPTR,#TAB4
LOOP5:
INC R1
CJNE R1,#9,LKSHOW5
JMP RET5
LKSHOW5:
ACALL SHOW
LCALL DELAY
LCALL DELAY
JMP LOOP5
RET5:RET
WY16:
MOV DPTR,#TAB5
LOOP6:
INC R1
CJNE R1,#9,LKSHOW6
JMP RET6
LKSHOW6:
ACALL SHOW
LCALL DELAY
LCALL DELAY
JMP LOOP6
RET6:RET
;輸出程式
SHOW:
MOV A,R1
MOVC A,@A+DPTR
MOV LED,A
RET
;延時程式
DELAY10MS:
MOV R6,#100
NEXT1:
MOV R7,#250
DJNZ R7,$
DJNZ R6,NEXT1
RET
DELAY:
MOV R5,#4
NEXT:
JNB K1,BREAK;為0跳轉
LCALL DELAY10MS
DJNZ R5,NEXT
BREAK:RET
TAB1:
DB 11111111B,11111110B,11111100B,11111000B,11110000B,11100000B,11000000B,10000000B,00000000B
TAB2:
DB 11111111B,11111110B,11111100B,11111000B,11110000B,11100000B,11000000B,10000000B,00000000B
TAB3:
DB 11111111B,11111110B,11111100B,11111000B,11110000B,11100000B,11000000B,10000000B,00000000B
TAB4:
DB 11111111B,11111110B,11111100B,11111000B,11110000B,11100000B,11000000B,10000000B,00000000B
TAB5:
DB 11111111B,11111110B,11111100B,11111000B,11110000B,11100000B,11000000B,10000000B
END
總結
1,延時程式
DELAY10MS:
MOV R6,#100
NEXT1:
MOV R7,#250
DJNZ R7,$
DJNZ R6,NEXT1
RET
2.查表展示程式
WY12:
MOV DPTR,#TAB1
LOOP2:
INC R1
CJNE R1,#9,LKSHOW2
JMP RET2
LKSHOW2:
ACALL SHOW
LCALL DELAY
LCALL DELAY
JMP LOOP2
RET2:RET
;輸出程式
SHOW:
MOV A,R1
MOVC A,@A+DPTR
MOV LED,A
RET
MOV DPTR,#TAB1
INC R1
ACALL SHOW
SHOW:
MOV A,R1
MOVC A,@A+DPTR
MOV LED,A
RET
按鍵判斷
GO: SETB K1
JNB K1,INCR;k1為0轉移
JMP GO
INCR:
JNB K1,INCR
INC R0
ACALL PLAY
CJNE R0,#6,GO;不相等轉移
SJMP MAIN
來回流水燈
ORG 0000H
JMP MAIN
ORG 30H
MAIN:
MOV A,#0FFH
CLR C
MOV R2,#08H
LOOP1:;實驗中二極體低電平點亮,loop1帶進位位的迴圈左移
RLC A
MOV P0,A
CALL DELAY
DJNZ R2,LOOP1
MOV R2,#07H
LOOP2:;loop2迴圈右移動
RR A
MOV P0,A
CALL DELAY
DJNZ R2,LOOP2
JMP MAIN
DELAY: ;延時約1s
MOV R3,#10
D1: MOV R4,#200
D2: MOV R5,#248
DJNZ R5,$
DJNZ R4,D2
DJNZ R3,D1
RET
END