|
|||||||||||
Technical Support Support Resources
Product Information |
µVISION DEBUGGER: Using the AINx VTRegsInformation in this article applies to:
QUESTIONWhat are the AINx VTReg and how do I use it? ANSWERWhen simulating a target microcontroller, the Keil µVision Debugger provides Virtual Target Registers (VTRegs) to allow you to provide input to the pins of the simulated device. The AINx VTRegs represent the inputs to the analog input pins of the MCU for analog input 0, 1, 2, and so on. So, if you have configured the analog inputs, the following commands (typed in the debugger Command Window) input the voltages specified. AIN0 = 0.000 /* Analog Input 0 = 0.000 volts */ AIN1 = 2.500 /* Analog Input 0 = 2.500 volts */ AIN2 = 4.999 /* Analog Input 0 = 4.999 volts */ You may create signal functions that inject waveforms into the analog inputs. For example: signal void analog0_sine (float limit) { float i; float sine; printf ("Analog0_sine (%f) entered.\n", limit); while (1) { /* forever */ /* SIN swings from -1 to 1 so... adjust it to scale from 0 to 1 */ /* This is a Taylor series that calculates SIN */ /* i is the angle where -1.0 = -pi/2 and 1.0 = +pi/2 */ for (i = -1.0; i < 1.0; i += 0.01) { sine = i * (1.570796329 - i * i * (0.6459640960 - i * i * (0.07969262599 - i * i * (0.004681754102 - i * i * (0.0001604411842))))); /* printf ("SIN(%4f) = %6f\n", i * 90.0, sine); */ ain0 = ((sine + 1.0) / 2.0) * limit; twatch (2000000); } for (i = 1.0; i > -1.0; i -= 0.01) { sine = i * (1.570796329 - i * i * (0.6459640960 - i * i * (0.07969262599 - i * i * (0.004681754102 - i * i * (0.0001604411842))))); /* printf ("SIN(%4f) = %6f\n", i * 90.0, sine); */ ain0 = ((sine + 1.0) / 2.0) * limit; twatch (2000000); } } } SEE ALSO
Last Reviewed: Thursday, January 7, 2021 | ||||||||||
|
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.