传送:
ORG 0000H
LJMP MAIN
ORG 0100H
ORG 0003H
MAIN:MOV SCON,#80
ORL PCON,#80H
CLR TI
SENT: MOV DPTR,#T
MOV R3,#1
MOV R0,#00
LOOP:MOV A,R0
MOVC A,@A+DPTR
LCALL DELAY
MOV SBUF,A;·¢Ëí
WAIT:JBC TI,CON
SJMP WAI
CONT: INC R0
DJNZ R3,LOO
CLR A
SJMP SENT
TAB: DB 3FH,06H,5BH,4FH,66H,6DH,7DH,07H,7FH,6FH
DELAY:MOV R6,#05H
DL3:MOV R4,#0FAH
DL2:MOV R5,#0F6H
DL1:DJNZ R5,DL1;246us
DJNZ R4,DL2;£¨246+4£©*250=62500us
DJNZ R6,DL3;62500*16=1s
RET
END
接收:
ORG 0000H
LJMP MAIN
ORG 0003H
ORG 0003H
MAIN:MOV P1,#3FH
MOV SCON,#80
ORL PCON,#80H
MOV R7,#12
SETB REN
CLR RI
WAIT:JBC RI,REA
SJMP WAIT
READ:MOV A,SBU
MOV P1,A
DJNZ R7,WAIT
SJMP WAIT
END
|