51单片机串口通讯(汇编)
ORG 0000H
LJMP START
ORG 0030H
START: MOV SP,#60H
MOV SCON,#40H
MOV PCON,#00H
MOV TMOD,#20H
MOV TH0,#0FDH
MOV TL0,#0FDH
SETB TR1
RETURN: MOV R0,#00H
MOV A,R0
MOV DPTR,#TAB
GOON: MOVC A,@A+DPTR
MOV SBUF,A
LOOP: JBC TI,NEXT
AJMP LOOP
NEXT: LCALL DELAY05S
INC R0
MOV A,R0
CJNE A,#16,GOON
AJMP RETURN
DELAY05S:MOV R7,#05
D1: MOV R6,#200
D2: MOV R5,#250
DJNZ R5,$
DJNZ R6,D2
DJNZ R7,D1
RET
TAB: DB "I ","Love ","AT89C51 "
END
LJMP START
ORG 0030H
START: MOV SP,#60H
MOV SCON,#40H
MOV PCON,#00H
MOV TMOD,#20H
MOV TH0,#0FDH
MOV TL0,#0FDH
SETB TR1
RETURN: MOV R0,#00H
MOV A,R0
MOV DPTR,#TAB
GOON: MOVC A,@A+DPTR
MOV SBUF,A
LOOP: JBC TI,NEXT
AJMP LOOP
NEXT: LCALL DELAY05S
INC R0
MOV A,R0
CJNE A,#16,GOON
AJMP RETURN
DELAY05S:MOV R7,#05
D1: MOV R6,#200
D2: MOV R5,#250
DJNZ R5,$
DJNZ R6,D2
DJNZ R7,D1
RET
TAB: DB "I ","Love ","AT89C51 "
END