Keil Logo

Simulate Interrupts and Clock Inputs

µVision simulates the behavior of I/O inputs. If an I/O pin is configured as counter input, then the count value increments when the pin toggles. The following example shows how to simulate input for Counter 3:

// in your C user program
T3CON = 0x004B;              // set T3 Counter Mode

You may toggle the counter input P3.6 with the VTREG PORT3, i.e. with a signal function:

signal void ToggleT3Input (void) {
  while (1) {
    PORT3 = PORT3 ^ 0x0040;             // toggle P3.6
    twatch (CLOCK / 100000);            // with 100kHz

Timer/Counter Peripheral Dialog

View of the Counter 3 status with the Peripheral dialog.

Also, interrupt inputs are simulated: if a port pin is used as interrupt input, then the interrupt request will be set when you toggle the associated I/O pin.

  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.