Keil Logo

Peripheral Simulation

For Silicon Laboratories, Inc. C8051F315 — 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

Comparator

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.
  • CORSEF (Comparator 0 Reset Flag) is set to reset Comparator 0.
  • 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.
  • CPT0MX (Comparator 0 MUX Selection Register) contains the positive and negative input controls for CMX0P and CMX0N.
  • CMX0P (Comparator 0 Positive Input MUX Select) selects the port pins to be used for positive input.
  • CMX0N (Comparator 0 Negative Input MUX Select) selects the port pins to be used for negative input.
  • 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.
  • CPT0MD (Comparator 0 Mode Selection Register) selects the Comparator 0 response time.
  • CP0RIE (Comparator Rising-Edge Interrupt Enable) is set to enable the comparator rising-edge interrupt.
  • CP0FIE (Comparator Falling-Edge Interrupt Enable) is set to enable the comparator falling-edge interrupt.

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.
  • CPT1MX (Comparator 1 MUX Selection Register) contains the positive and negative input controls for CMX0P and CMX0N.
  • CMX1P (Comparator 1 Positive Input MUX Select) selects the port pins to be used for positive input.
  • CMX1N (Comparator 1 Negative Input MUX Select) selects the port pins to be used for negative input.
  • 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.
  • CPT1MD (Comparator 1 Mode Selection Register) selects the Comparator 1 response time.
  • CP1RIE (Comparator Rising-Edge Interrupt Enable) is set to enable the comparator rising-edge interrupt.
  • CP1FIE (Comparator Falling-Edge Interrupt Enable) is set to enable the comparator falling-edge interrupt.

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
Get more information about the
Peripheral Simulation Capabilities
of the µVision Debugger.
  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.