Actually I intend to design a DLL interface for serial communication supporting MARK and SPACE mode. When the data from outside come, I wish the simulation to put them into the registers of the 8051. However, as mentioned before, the SBUF seems of little use, and I have tried SIN, which I assumed that the value in SBUF would change with it accordingly but found that it was of no help. What should I do to get the data into the registers? Thanks!
"What I learned is that in MARK mode the parity is always 1, whereas in SPACE mode the parity is 0." Not quite - you are suffering from sloppy terminology, I'm afraid. There is no such thing as "Mark Mode" nor "Space Mode." What you are talking about is "Mark-Parity" and "Space-Parity" - ie, when the Parity bit is "fixed" in the Mark or Space state, irrespective of the other bits in the byte. Anyhow, why do you specifically need this setting?
"I run a program sending data from COM2 to COM1!" Have you checked independently that the connection from COM2 to COM1 is actually working? eg, by using Hypoterminal?
Yes, I have checked them, they are working normally. My previous test in the keil is using the program pasted above. I checked it assigning COM1 to sin and sout, while using a program to send out data from COM2.
In the Interupt you should not read SBUF unless RI=1 You should not write to SBUF unless TI = 1 (except for the first byte of course) I doubt changing IE helps anything. adjust the Interupt priority if need be.