1个回答
展开全部
甲机:
ORG 0000H
LJMP MAIN
ORG 0030H
MAIN:
MOV TMOD,#20H
MOV TH1,#0FDH
MOV TL1,#0FDH
MOV SCON,#40H
SETB TR1
MOV R0,#30H
MOV R2,#16
JB P1.0,$ ;按排一个按键启动传送数据
JNB P1.0,$
LOOP:
MOV A,@R0
MOV SBUF,A
JNB TI,$
CLR TI
INC R0
DJNZ R2,LOOP
SJMP MAIN
END
乙机:
ORG 0000H
LJMP MAIN
ORG 0023H
LJMP UART
ORG 0030H
MAIN:
MOV TMOD,#20H
MOV TH1,#0FDH
MOV TL1,#0FDH
MOV SCON,#50H
SETB TR1
SETB ES
SETB EA
MOV R0,#20H
SJMP $
UART:
JB RI,UARTE
MOV A,SBUF
MOV @R0,A
INC R0
CJNE R0,#30H,UARTE
MOV R0,#20H
UARTE:
RETI
END
ORG 0000H
LJMP MAIN
ORG 0030H
MAIN:
MOV TMOD,#20H
MOV TH1,#0FDH
MOV TL1,#0FDH
MOV SCON,#40H
SETB TR1
MOV R0,#30H
MOV R2,#16
JB P1.0,$ ;按排一个按键启动传送数据
JNB P1.0,$
LOOP:
MOV A,@R0
MOV SBUF,A
JNB TI,$
CLR TI
INC R0
DJNZ R2,LOOP
SJMP MAIN
END
乙机:
ORG 0000H
LJMP MAIN
ORG 0023H
LJMP UART
ORG 0030H
MAIN:
MOV TMOD,#20H
MOV TH1,#0FDH
MOV TL1,#0FDH
MOV SCON,#50H
SETB TR1
SETB ES
SETB EA
MOV R0,#20H
SJMP $
UART:
JB RI,UARTE
MOV A,SBUF
MOV @R0,A
INC R0
CJNE R0,#30H,UARTE
MOV R0,#20H
UARTE:
RETI
END
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询
广告 您可能关注的内容 |