|
|||||||||||
|
µVision® IDE µVision® Debugger
Further Information |
A/D Converter Simulation
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.
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’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.