check with this code. at first it displays ok in pc then what ever you type in keyboard will be retarnsmitted by themicro controller and same will be displayed in pc
ORG 0H
JMP MAIN
ORG 30H
MAIN:
CALL INIT
MOV SBUF,#'O'
JNB TI,$
CLR TI
CALL DELAY
MOV SBUF,#'K'
JNB TI,$
CLR TI
AGAIN:
JNB RI,$
MOV A,SBUF
CLR RI
MOV SBUF,A
JNB TI,$
CLR TI
JMP AGAIN
INIT:
MOV TMOD,#21H;;;;;;;;;;;;;9600BAUD RATE,8-BIT,1-STOP BIT;;;;;;;;;;;;;;
MOV TH1,#0FDH;
MOV SCON,#50H
SETB TR1
RET
DELAY:
MOV R7,#10D
L2: MOV R6,#100D
L1:
CALL DEL
DJNZ R6,L1
DJNZ R7,L2
RET
DEL:
MOV TL0,#7CH
MOV TH0,#0FCH
SETB TR0
JNB TF0,$
CLR TR0
CLR TF0
RET;
END