ARM Technical Support Knowledge Articles

USING THE SOUT VTREG

Applies to: uVision Debugger

Answer


Information in this article applies to:


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

ANSWER

When simulating a target microcontroller, the Keil uVision 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) {
    wwatch(SOUT);
    printf ("I got a 0x%2.2X.
", 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.

SEE ALSO

Article last edited on: 2005-03-28 10:32:24

Rate this article

[Bad]
|
|
[Good]
Disagree? Move your mouse over the bar and click

Did you find this article helpful? Yes No

How can we improve this article?

Link to this article
Copyright © 2011 ARM Limited. All rights reserved. External (Open), Non-Confidential