; 简单的Uart Test: p2.0=1 时, LOOP TEST, P2.0=0 时, 发1200HZ方波
ORG 000H
mov SCON, #052h
mov TMOD, #020h
mov TH1, #0F4h ; 11.0592HZ 2400 BPS
setb TR1 ;TCON.6
;--------------------------------------
MainLoop:
JNB P2.0, L_TX_1200hz
JBC RI, L_RX
SJMP MainLoop
L_RX:
MOV A, SBUF
MOV SBUF, A
SJMP MainLoop
L_TX_1200hz:
JBC TI, L_TX_55H
SJMP MainLoop
L_TX_55H:
MOV SBUF, #055H
SJMP MainLoop
end |