my first Q is, while simulating in KEIL does it not able to read the SBUF. when i am simulating the program and i make RI high then it goes to the intrupet and then put SBUF= any value like SBUF='s' and then the cursor goes to my reading line i.e var=SBUF; but after this there is no value in var and one more thing if the var has some value before var=SBUF; it goes zero all gone . so now i am doubting keil simulator. but my transmit part is working fine.
You _write_ to SBUF with the intention to send something out.
To be able to _read_ from SBUF, the serial port must have _received_ something from outside.
SBUF is one read-only register mapped to the same address as one write-only register. Same in simulator and actual hardware. Same in quite a number of processors, since it isn't meaningful to try to catch what character you have already dropped off to send.
When you drop a letter into the narrow mail box slot, you are not indented to be able to get it back and get a second view of it either..