实验7 D/A转换实验

OUTBIT EQU 0E101H;
CLK164 EQU 0E102H
DAT164 EQU 0E102H
IN EQU 0E103H
LEDBUF EQU 40H
ORG 0000H
MOV SP,#60H
MOV DPTR ,#0E100H
MOV A,#30H
MOVX @DPTR,A
MOV 40H,#00H
MOV 41H,#08H
MOV 42H,#03H
MOV 43H,#02H
LOOP1:MOV R5,#00H
LOOP2: MOV DPTR,#0B000H
MOV A,R5
MOVX @DPTR,A
MOV R0,#45H
MOV 45H,A
ACALL PTDS
MOV R6,#15H
DIR10:ACALL DISPLAY
DJNZ R6,DIR10
INC R5
CJNE R5,#00H,LOOP2
LOOP3:MOV DPTR,#0B000H
DEC R5
MOV A,R5
MOVX @DPTR,A
MOV R0,#45H
ACALL PTDS
MOV R6,#15H
DIR11:ACALL DISPLAY
DJNZ R6,DIR11
CJNE R5,#00H,LOOP3
SJMP LOOP1
DELAY:
MOV R7,#01
MOV R3,#01
DELAYLOOP:
DJNZ R3,DELAYLOOP
DJNZ R6,DELAYLOOP
RET
DISPLAY:SETB 0D3H
MOV R0,#LEDBUF
MOV R1,#6
MOV R2,#00100000B
LOOP:
MOV DPTR,#OUTBIT
MOV A,#00H
MOVX @DPTR,A
MOV A,@R0
MOV DPTR,#LEDMAP
MOVC A,@A+DPTR
MOV B,#8
DLP:
RLC A
MOV R3,A
MOV ACC.0,C
ANL A,#0FDH
MOV DPTR,#DAT164
MOVX @DPTR,A
MOV DPTR,#CLK164
ORL A,#03H
MOVX @DPTR,A
ANL A,#0FDH
MOVX @DPTR,A
MOV A,R3
DJNZ B,DLP
MOV DPTR,#OUTBIT
MOV A,R2
MOVX @DPTR,A
MOV R6,#01
CALL DELAY
MOV A,R2
RR A
MOV R2,A
INC R0
DJNZ R1,LOOP
MOV DPTR,#OUTBIT
MOV A,#0
MOVX @DPTR,A
CLR 0D3H
RET
LEDMAP:
DB 3FH,06H,5BH,4FH,66H,6DH,7DH,07H
DB 7FH,6FH,77H,7CH,39H,5EH,79H,71H
PTDS:MOV R1,A
ACALL PTDS1
MOV A,R1
SWAP A
PTDS1:ANL A,#0FH
MOV @R0,A
DEC R0
RET
DELAY1:MOV R7,#03H
SJMP DELAYLOOP
END

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值