Keil Logo

Peripheral Variables

µVision3 automatically defines a number of symbols depending on the CPU you have selected for your project. There are two types of symbols that are defined: Peripheral Registers (or special function registers SFRs) and Virtual Simulation Registers (VTREGs). Debug Functions that may be used to automate input to peripherals are provided under Simulation Script Templates.

Peripheral Registers (SFRs)

µVision3 defines symbols for the peripheral registers. The peripheral register symbols available depend on the microcontroller you have selected. The peripheral register symbols and have an associated address and may be used in expressions.

Virtual Simulation Registers (VTREGs)

Virtual Simulation registers, or VTREGs, let you use the CPU's simulated pins for input and output. VTREGs are not public symbols nor do they reside in a memory space of the CPU. They may be used in expressions, but their values and utilization are CPU dependent. VTREGs provide a way to specify signals coming into the CPU from a simulated piece of hardware. You can list these symbols with the DIR VTREG command.

The following table describes the VTREG symbols. The VTREG symbols that are actually available depend on the selected CPU.

VTREG Description
ADx An analog input pin on the chip which are typically A/D converter inputs. Your target program may read values you write to ADx VTREGs.
DAx An analog output pin on the chip. This values typically reflect the output of a D/A converter.
xxVREF Input for voltage reference pins.
PORTx A group of I/O pins for a port on the chip. For example, PORTA refers to all pins of PORTA. These registers allow you to simulate port I/O.
SxIN The input buffer of serial interface x. You may write 8-bit or 9-bit values to SxIN. These are read by your target program. You may read SxIN to determine when the input buffer is ready for another character. The value 0xFFFF signals that the previous value is completely processed and a new value may be written.
SxOUT The output buffer of serial interface x. µVision3 copies 8-bit or 9-bit values (as programmed) to the SxOUT VTREG.
SxTIME Defines the baudrate timing of the serial interface x. When SxTIME is 1, µVision3 simulates the timing of the serial interface using the programmed baudrate. When SxTIME is 0 (the default value), the programmed baudrate timing is ignored and serial transmission time is instantaneous.
CLOCK The real clock frequency of the simulated CPU.
XTAL The crystal frequency of the simulated CPU as defined in the Options – Target dialog.

Notes

  • You may use the VTREGs to simulate external input and output including interfacing to internal peripherals like interrupts and timers. For example, if you toggle bit 2 of PORT3 (on the 8051 drivers), the CPU driver simulates external interrupt 0.

Related Knowledgebase Articles

  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.