;;c51控制双色点阵左移显示与右移显示.;;
;;;程序显示的为6;;
ORG 0
AJMP MAIN
MAIN:
MOV 30H,#00H
MOV 31H,#00H
MOV 32H,#0FEH
MOV 33H,#92H
MOV 34H,#92H
MOV 35H,#0F2H
MOV 36H,#00H
MOV 37H,#00H
mov 2fh,#7fh
MOV 29H,#00H
loopm:
acall led
ACALL DELAY
;; ACALL DELAY
ACALL REDL
ajmp loopm
led:
mov r6,#08h
loop1:
MOV R3,#08
mov r0,#37h
clr c
mov a,30h
;mov a,37h
; mov r0,#30h
dd1:
clr C
xch a,@r0
;inc r0
dec r0
djnz r3,dd1
mov r3,#08
MOV R0,#37H;;;
ACALL LOOP2
ACALL LOOP2
ACALL LOOP2
ACALL LOOP2
ACALL LOOP2
ACALL LOOP2
DJNZ R6,LOOP1
MOV R6,#08
ret
loop2:
mov r0,#30h
mov r7,#08h
LOOP: ;;;;;;;;;;;;;;;;;;;;
MOV P0,#00H;;;;LED
MOV P1,#0FFH
MOV P2,@R0 ;;
MOV P1,2FH
INC R0
ACALL DELAY2
MOV A,2FH
RR A;;
MOV 2FH,A ;;;;;LED
DJNZ R7,LOOP ;;;;;;;;;;;;;;;;;;;
mov p2,#00h
mov p1,#0ffh
mov p0,#00h
RET
REDL:
mov r6,#08h
RELOOP1:
MOV R3,#08
clr c
mov a,37h
mov r0,#30h
REdd1:
clr C
xch a,@r0
inc r0
djnz r3,REdd1
mov r3,#10H;;08
MOV R0,#37H;;;
ACALL REDLOOP
ACALL REDLOOP
ACALL REDLOOP
ACALL REDLOOP
ACALL REDLOOP
acall delay;;;;;;
DJNZ R6,RELOOP1
MOV R6,#10H;;08
ret
REDLOOP:
mov r0,#30h
mov r7,#08h
REDLOOP2: ;;;;;;;;;;;;;;;;;;;;
MOV P2,#00H;;;;LED
MOV P1,#0FFH
MOV P0,@R0 ;;
MOV P1,2FH
INC R0
ACALL DELAY2
MOV A,2FH
RR A;;
MOV 2FH,A ;;;;;LED
DJNZ R7,REDLOOP2 ;;;;;;;;;;;;;;;;;;;
mov p2,#00h
mov p1,#0ffh
mov p0,#00h
RET
DELAY2:
MOV R5,#5
DD2:MOV R4,#250
DJNZ R4,$
DJNZ R5,DD2
RET
DELAY:
MOV R5,#100
D:MOV R4,#250
DJNZ R4,$
DJNZ R5,D
RET
END
上一篇:AT89C2051单片机驱动步进电机的电路和源码
下一篇:基于 TLC2543设计的采集系统
推荐阅读最新更新时间:2024-03-16 13:51