main:mov scon,#50h;串口方式1,允许接收
mov tmod,#20h;00100000B,定时器T1自动重装入8位定时器,方式2
mov th1,#0fdh;波特率9600
mov tl1,#0fdh
setb tr1
jieshou:jnb ri,$;在此处接收主机数据
clr ri
mov a,sbuf
cjne a,#1,jieshou
cpl p3.2
lcall d250ms
ajmp jieshou
d250ms:mov 31h,#250
p2212:mov 32h,#250
wt22:nop
nop
djnz 32h,wt22
djnz 31h,p2212
ret
end
离线