
ORG 0000H 
DYTA EQU 50H 
AJMP START 


START: MOV TMOD, #20H ;set timer1 to mode 2 
MOV SCON, #01010000B ;set UART to mode 1 
MOV TH1, #0FDH ;Fosc=12M, baudrate=9600 
MOV TL1, #0FDH 
SETB TR1 

; Set the TI bit since you can start transmitting
; when the program starts (there is nothing in
; the transmit buffer)
SETB TI

LOOP:
JNB RI, $ 
MOV A, SBUF 
MOV DYTA, A 
CLR RI 


; Move TI test above sending a character
; This lets the program run while transmitting
; Otherwise, the program does not get transmit
; at the full baud rate
JNB TI, $ 
MOV SBUF, DYTA 
CLR TI 

; Add a JMP so that the program
; Jumps back to get another character
JMP LOOP

END 
