Keil Logo

Peripheral Simulation

For Infineon C166 (all Variants) — Asynchronous/Synchronous Serial Interface ASC1 (without Autobaud)

Simulation support for this peripheral or feature is comprised of:

  • Dialog boxes which display and allow you to change peripheral configuration.
  • VTREGs (Virtual Target Registers) which support I/O with the peripheral.

These simulation capabilities are described below.

Serial Interface ASC1 Dialog

Serial Interface ASC1

The Serial Interface ASC1 dialog displays and allows you to edit the configuration of the Asynchronous/Synchronous Serial Interface. The controls in this dialog are separated into several logical groups.

The Mode group contains the following controls.

  • Mode displays and allows you to change the serial interface mode of operation (data length and synchronous or asynchronous).
  • Baudrate is the actual baudrate.
  • S1BG is the ASC1 Baudrate Generator Reload Register (SFR).
  • S1CON is the ASC1 Control Register (SFR).
  • S1TBUF is the ASC1 Transmit Buffer Register (SFR).
  • S1RBUF is the ASC1 Receive Buffer Register (SFR).
  • S1R enables the baudrate generator.
  • S1STP specifies the number of stop bits (cleared for 1, checked for 2).
  • S1REN enables serial data reception.
  • S1LB enables loopback mode.
  • S1BRS specifies how the baudrate is generated (cleared to divide clock by reload+constant, checked to reduce serial clock to 2/3).

The Error Detection group contains the following controls.

  • S1OEN enables overrun checking.
  • S1OE indicates an overrun error was detected.
  • S1FEN enables frame checking.
  • S1FE indicates a framing error was detected.
  • S1PEN enables parity checking.
  • S1PE indicates a parity error was detected.

The Interrupts group contains the following controls.

  • S1TIR is the ASC1 transmit interrupt request flag.
  • S1RIR is the ASC1 receive interrupt request flag.
  • S1EIR is the ASC1 error interrupt request flag.

The Ports group contains the following controls.

  • P3.8 is the state of the TxD1 output pin.
  • DP3.8 is the data direction register for the TxD1 pin.
  • DP3.9 is the data direction register for the RxD1 pin.

Data Type: unsigned int

The S1IN VTREG represents the ASC1 serial input of the simulated microcontroller. Values you assign to S1IN are input to the serial channel. You may assign input using the command window. For example,


causes the simulated microcontroller serial input to receive the ASCII character A. If you want to use the S1IN VRTEG to simulate reception of multiple characters, you must be sure to delay for at least one character time between successive assignments to S1IN. This may be done using a signal function. For example:

signal void send_cat (void) {
swatch(0.01);  /* Wait 0.01 seconds */
S1IN='C';       /* Send a C */

You may use the S1IN VTREG to input more than 8 bits of data. For example,


inputs a 9-bit value. In addition to the S1IN VRTEG, the serial window allows you to input serial characters by simply typing. Serial characters that are transmitted byt the simulated microcontroller appear in the serial window.

Data Type: unsigned int

The S1OUT VTREG represents the serial output from the simulated microcontroller. Whenever the simulated serial port transmits a character, the value transmitted is automatically assigned to S1OUT (which is read-only). You may read the value of S1OUT to determine the character transmitted by your simulated program. For example,


outputs the value of the last character transmitted. You may use the S1OUT VTREG in a script to process transmitted data. For example,

signal void s1out_sig (void) {
while (1)
  wwatch(S1OUT);     /* wait for something in S1OUT */
  printf ("Transmitted a %2.2X\n", (unsigned) S1OUT);

Data Type: unsigned int

The STIME VTREG allows you to control the timing of the simulated serial port.

  • A value of 1 (which is the default) indicates that the serial port timing is identical to the target hardware. Use this value when you want to see the effects of baud rate on the serial port I/O.
  • A value of 0 indicates that all serial input and output occur instantaneously. Use this value when you don't care about any baud rate effects or when you want serial output to be fast.

For example:

S1TIME = 0   /* Set Serial Port for FAST timing */
S1TIME = 1   /* Set Serial Port for accurate timing */
Get more information about the
Peripheral Simulation Capabilities
of the µVision Debugger.
  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.