Peripheral Simulation
For Toshiba TMPM330FWFG — Analog/Digital Converter (ADC)
Simulation support for this peripheral or feature is comprised of:
- VTREGs (Virtual Target Registers) which support I/O with the peripheral.
These simulation capabilities are described below.
ANx VTREG
Data Type: float
The ANx VTREGs set the analog input voltages for simulated A/D
converters. The ANx VTREGs represent the inputs to the analog input
pins of the MCU for analog input 0, 1, 2, and so on. AN0 sets the
input voltage for analog input #0, AN1 sets the input voltage for
analog input #1, etc. If you have properly configured the analog
inputs, the following commands (typed in the debugger's Command
Window) input the voltages specified.
AN0 = 0.000 /* Analog Input 0 = 0.000 volts */
AN1 = 2.500 /* Analog Input 1 = 2.500 volts */
AN2 = 4.999 /* Analog Input 2 = 4.999 volts */
You may also enter the analog input voltages using the A/D
Converter Dialog which is accessable from the Peripherals menu. You
may create a debugger signal function to periodically change the
value of the A/D input. The following signal function increases the
A/D Channel 1 input voltage by 0.1 volts each second.
signal void AN1_sig (void) {
float f;
for (f = 0.0; f < 5.0; f += 0.1)
{
swatch (1.0); // Delay 1 second
AN1 = f; // Set AN1 Voltage
}
}