当前位置: 首页 > >

实验8 A/D转换实验

发布时间:

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,#03H
MOVX @DPTR,A
MOV 40H,#00H
MOV 41H,#08H
MOV 42H,#00H
MOV 43H,#09H
MOV 44H,#00H
MOV 45H,#00H
LOOP1:MOV R7,#40
VI:LCALL DISPLAY
DJNZ R7,VI
MOV A,#00H
MOV DPTR,#0A000H
MOVX @DPTR,A
MOV R7,#0FH
LOOP2:DJNZ R7,LOOP2
MOVX A,@DPTR
MOV R0,#45H
LCALL PTDS
SJMP LOOP1
PTDS :MOV R1,A
LCALL PTDS1
MOV A,R1
SWAP A
PTDS1:ANL A,#0FH
MOV @R0,A
DEC R0
RET
DELAY:
MOV R7,#0
DELAYLOOP:
DJNZ R7,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,#02H
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,#1
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
END




友情链接: