We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
SBUF is not a regular register: when you write to it you send a character on the serial line, and when you read it you empty the serial line buffer Keil simulates sbuf like if it was a normal variable because if you try to do the same thing on hardware (emulator or chip) it won't work.
The simulator maintains two VTREG's for exactly this purpose. SIN is the input register SOUT is the output register More information about this is provided in the Getting Started with uVision2 User's Guide, Chapter 5, CPU Pin Registers (VTREGs).