Keil™, An ARM® Company

µVision® IDE & Debugger

This feature works with...
ARMC166C251C51Eval

Debugger Functions

The µVision debugger incorporates a C function language you can use to respond to program output and create input stimulus. A number of built-in debugger functions, like printf, memset, and rand, are available.

You may create:

  • Signal functions to simulate analog and digital inputs to the CPU.
  • User functions that extend the command scope of the debugger and combine repetitive actions.

Signal functions describe the behavior of external hardware and supply input to the microcontroller's I/O pins. Signal functions run in the background while the µVision debugger simulates your target program.

For example, the following signal function generates an analog input ramp on A/D Input 0.

SIGNAL void analog0 (float limit) {
  float volts;

  printf ("ANALOG0 (%f) ENTERED\n", limit);
  while (1) { /* forever */
    volts = 0;
    while (volts <= limit) {
    AIN0 = volts;    /* Set A/D Input 0 */
    swatch (0.5);    /* Delay for 0.5 seconds */
    volts += 0.5;    /* Increase voltage */
    }
  }
}

There are several ways you can invoke debugger functions:

  • From the Command Line in the Output Window,
  • From a button in the Toolbox,
  • or From a breakpoint definition.