Keil Logo


Information in this article applies to:

  • µVision Version 2 and Later

What is the SOUT/SOUT0/SOUT1 VTReg and how do I use it?


When simulating a target microcontroller, the Keil µVision Debugger provides Virtual Target Registers (VTRegs) to allow you to provide input to the pins of the simulated device.

The SOUT, SOUT0, and SOUT1 VTRegs represent the output of the on-chip serial port. The SOUTx form is used for MCUs with multiple serial ports. These VTRegs are written with the actual ASCII character value that would be shifted out the serial port.

You may read these VTRegs at any time. However, since they are updated in response to serial output it is probably best to use the wwatch function in a signal to wait for them to be written. There is no other way to detect when the SOUT VTReg changes.

The following debugger script outputs serial data as it happens.

signal void print_sout (void) {
  while (1) {
    printf ("I got a 0x%2.2X.\n", SOUT);

To run this script, you must enter print_sout() in the debugger Command Window.

Note that the SOUT VTRegs are not updated immediately when your program writes to the serial transmit buffer. This is because in reality it takes some time for the data to be shifted out the serial port. You can control this timing with the STIME VTRegs.

Many of the VTREGs for a microcontroller are listed in the Keil online Device Database.

Go to the Device Database, select the microcontroller, look under 'Simulated Features' and select the peripheral in question. The VTREGs for that peripheral are listed at the end of the peripheral simulation details window.

For example, some microcontrollers may use the SxOUT VTREG instead of the SOUTx VTREG.


Last Reviewed: Monday, March 28, 2005

Did this article provide the answer you needed?
Not Sure
  Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.

Change Settings

Privacy Policy Update

Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.