51单片机做的LED数码管拉幕仿真
- DISPBUF EQU 30H
- DISPCNT EQU 38H
- DISPBIT EQU 39H
- T1CNTA EQU 3AH
- T1CNTB EQU 3BH
- CNT EQU 3CH
- ORG 00H
- LJMP START
- ORG 0BH
- LJMP INT_T0
- START:
- MOV DISPCNT,#8
- MOV R1,#DISPBUF
- LP:
- MOV A,#10
- MOV @R1,A
- INC R1
- DJNZ DISPCNT,LP
- MOV DISPBIT,#00H
- MOV T1CNTA,#00H
- MOV T1CNTB,#00H
- MOV CNT,#00H
- MOV TMOD,#01H
- MOV TH0,#(65536-1000) / 256
- MOV TL0,#(65536-1000) MOD 256
- SETB TR0
- SETB ET0
- SETB EA
- SJMP $
- INT_T0:
- MOV TH0,#(65536-1000) / 256
- MOV TL0,#(65536-1000) MOD 256
- MOV A,#0FFH
- MOV P1,A
- MOV A,DISPBIT
- ADD A,#DISPBUF
- MOV R0,A
- MOV A,@R0
- MOV DPTR,#TABLE
- MOVC A,@A+DPTR
- MOV P0,A
- MOV A,P1
- ANL A,#0F8H
- ADD A,DISPBIT
- MOV P1,A
- INC DISPBIT
- MOV A,DISPBIT
- CJNE A,#08H,NEXT
- MOV DISPBIT,#00H
- NEXT:
- INC T1CNTA
- MOV A,T1CNTA
- CJNE A,#50,LL1
- MOV T1CNTA,#00H
- INC T1CNTB
- MOV A,T1CNTB
- CJNE A,#8,LL1
- MOV T1CNTB,#00H
- INC CNT
- MOV A,CNT
- CJNE A,#9,LLX
- MOV CNT,#00H
- MOV A,CNT
- LLX:
- CJNE A,#01H,NEX1
- MOV 30H,#8
- LL1:
- LJMP DONE
- NEX1:
- CJNE A,#02H,NEX2
- MOV 31H,#7
- MOV 30H,#8
- LJMP DONE
- NEX2:
- CJNE A,#03H,NEX3
- MOV 32H,#6
- MOV 31H,#7
- MOV 30H,#8
- LJMP DONE
- NEX3:
- CJNE A,#04H,NEX4
- MOV 33H,#5
- MOV 32H,#6
- MOV 31H,#7
- MOV 30H,#8
- LJMP DONE
- NEX4:
- CJNE A,#05H,NEX5
- MOV 34H,#4
- MOV 33H,#5
- MOV 32H,#6
- MOV 31H,#7
- MOV 30H,#8
- LJMP DONE
- NEX5:
- CJNE A,#06H,NEX6
- MOV 35H,#3
- MOV 34H,#4
- MOV 33H,#5
- MOV 32H,#6
- MOV 31H,#7
- MOV 30H,#8
- LJMP DONE
- NEX6:
- CJNE A,#07H,NEX7
- MOV 36H,#2
- MOV 35H,#3
- MOV 34H,#4
- MOV 33H,#5
- MOV 32H,#6
- MOV 31H,#7
- MOV 30H,#8
- LJMP DONE
- NEX7:
- CJNE A,#08H,NEX8
- MOV 37H,#1
- MOV 36H,#2
- MOV 35H,#3
- MOV 34H,#4
- MOV 33H,#5
- MOV 32H,#6
- MOV 31H,#7
- MOV 30H,#8
- LJMP DONE
- NEX8:
- CJNE A,#00H,DONE
- MOV 37H,#10
- MOV 36H,#10
- MOV 35H,#10
- MOV 34H,#10
- MOV 33H,#10
- MOV 32H,#10
- MOV 31H,#10
- MOV 30H,#10
- LL: LJMP DONE
- DONE: RETI
- TABLE: DB 3FH,06H,5BH,4FH,66H,6DH,7DH,07H,7FH,6FH,00H
- ;
- END
复制代码
led拉幕设计.zip
(72.02 KB, 下载次数: 9)
|