This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

simulation of sbuf

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).