Peripheral Simulation
For Silicon Laboratories, Inc. C8051F220 — Analog Comparators (0 and 1)
Simulation support for this peripheral or feature is comprised of:
- Dialog boxes which display and allow you to change peripheral configuration.
- VTREGs (Virtual Target Registers) which support I/O with the peripheral.
These simulation capabilities are described below.
Comparator Dialog
The Comparator Dialog controls simulation of the two voltage comparators in the device. When enabled, it allows the user to compare voltage sources to generate a logic-level signal to a variety of destinations. The controls in this dialog are separated into several logical groups.
Comparator 0
- CPT0CN (Comparator 0 Control Register) contains the following control bit settings:
- CP0EN (Comparator 0 Output Enable Bit) is set to enable comparator 0.
- CP0OUT (Comparator 0 Output State Flag) is set when the voltage on CP0P is greater than CP0N.
- CP0RIF (Comparator 0 Rising-Edge Interrupt Flag) is set when a Comparator 0 rising edge interrupt occurs.
- CP0FIF (Comparator 0 Falling-Edge Interrupt Flag) is set when a Comparator 0 falling edge interrupt occurs.
- CP0HYP (Comparator 0 Positive Hysteresis Control Bits) selects 0, 2, 4 or 10 mV of positive hysteresis.
- CP0HYN (Comparator 0 Negative Hysteresis Control Bits) selects 0, 2, 4 or 10 mV of negative hysteresis.
- CP0P (Comparator 0 Positive Input Voltage) displays the Comparator 0 negative input voltage.
- CP0N (Comparator 0 Negative Input Voltage) displays the Comparator 0 positive input voltage.
- CORSEF (Comparator 0 Reset Flag) is set to reset Comparator 0.
Comparator 1
- CPT1CN (Comparator 1 Control Register) contains the following control bit settings:
- CP1EN (Comparator 1 Output Enable Bit) is set to enable comparator 1.
- CP1OUT (Comparator 1 Output State Flag) is set when the voltage on CP1P is greater than CP1N.
- CP1RIF (Comparator 1 Rising-Edge Interrupt Flag) is set when a Comparator 1 rising edge interrupt occurs.
- CP1FIF (Comparator 1 Falling-Edge Interrupt Flag) is set when a Comparator 1 falling edge interrupt occurs.
- CP1HYP (Comparator 1 Positive Hysteresis Control Bits) selects 0, 2, 4 or 10 mV of positive hysteresis.
- CP1HYN (Comparator 1 Negative Hysteresis Control Bits) selects 0, 2, 4 or 10 mV of negative hysteresis.
- CP1P (Comparator 1 Positive Input Voltage) displays the Comparator 1 negative input voltage.
- CP1N (Comparator 1 Negative Input Voltage) displays the Comparator 1 positive input voltage.
CPxN VTREG
Data Type: float
CPxN is the negative input voltage for Comparator x. x is the Comparator number, 0 or 1. Typing the following command in the debugger's Command Window sets the negative input voltage for Comparator 1 to 1.5 volts:
CP1N = 5.5
You may display the Comparator 0 negative input voltage in the debugger's Output Window by typing the following command:
CP0N
CPxP VTREG
Data Type: float
CPxN is the positive input voltage for Comparator x. x is the Comparator number, 0 or 1. Typing the following command in the debugger's Command Window sets the positive input voltage for Comparator 0 to 0.75 volts:
CP0P = 0.75
You may display the Comparator 1 positive input voltage in the debugger's Output Window by typing the following command:
CP1P