51单片机串口通信汇编程序
发布网友
发布时间:2022-04-20 04:00
我来回答
共1个回答
热心网友
时间:2022-07-10 01:36
ORG 0000H
SJMP 0050H
ORG 0023H
LJMP S_INT
TAB:DB 20H,49H,20H,47H,45H,54H,20H,'NULL'
ORG 0050H
MOV TMOD,#20H
MOV TH1,#0FDH
MOV TL1,#0FDH
SETB TR1
SETB SM1
CLR SM0
SETB EA
SETB ES
MOV R0,#30H
MOV A,#1H
MAIN:SETB REN
ACALL DELAY
JNZ MAIN
MOV R2,#0
MOV DPTR,#TAB
MOV R7,#7
SEND:MOV A,R2
MOVC A,@A+DPTR
CLR ES
MOV SBUF,A
JNB TI,$
CLR TI
INC R2
DJNZ R7,SEND
MOV R0,#30H
SHOW:MOV A,@R0
MOV SBUF,A
JNB TI,$
CLR TI
INC R0
CJNE A,#40H,SHOW
SETB ES
MOV A,#1
MOV R0,#30H
SJMP MAIN
S_INT:CLR RI
MOV A,SBUF
MOV @R0,A
CJNE A,#40H,NEXT
MOV A,#0
NEXT:INC R0
RETI
DELAY:MOV 7DH,#200
LOOP1:MOV 7EH,#40
DJNZ 7EH,$
DJNZ 7DH,LOOP1
RET
END
这个是方式一的