Keil Logo
This feature works with...
ARM C166 C251 C51 Eval

A/D Converter Simulation

A/D Converter Dialog The µVision Debugger simulates the on-chip A/D Converter of most devices. All registers are fully simulated and the analog inputs may be viewed and changed in real-time.

The Analog/Digital Converter dialog box displays and allows you to adjust special function registers as well as the virtual registers associated with the A/D Converter.

The µVision Debugger defines special variables (called virtual target registers) for the analog voltage inputs. You may change the values of these registers to simulate different input voltages—either in the dialog box or on the command line.

For example, the following line:

AN2 = 2.5

when entered in the Command Window sets the Analog Input 0 to 2.5000 volts.

Logic Analyzer You can create C scripts for the the µVision Debugger that will run in the background while you debug your program. Scripts may be used to change the analog input values and simulate real-world input signals. It is easy to simulate a sine wave input, a triangle wave, and even complex waveforms.

Following is the C script for the triangle wave displayed on the left.

SIGNAL void analog1 (float limit)  {
  float volts;

  printf ("ANALOG0 (%f) ENTERED\n", limit);
  while (1)  {          /* forever */
    volts = 0;
    while (volts <= limit)  {
      an1 = volts;      /* analog input-0 */
      twatch (30000);   /* 30000 Cycles Time-Break */
      volts += 0.05;    /* increase voltage */
    }
    volts = limit - 0.05;
    while (volts >= 0.05)  {
      an1 = volts;
      twatch (30000);   /* 30000 Cycles Time-Break */
      volts -= 0.05;    /* decrease voltage */
    }
  }
}
  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.