Home / µVision User's Guide
C51, C251, C166 Development Tools


Simulate Interrupts and Clock Inputs
Home » Debugging » Tips and Tricks » 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
}
}

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.