UM10346_1
© NXP B.V. 2009. All rights reserved.
User manual
Rev. 01 — 2 November 2009
94 of 132
NXP Semiconductors
UM10346
LPC980/982 User manual
13.3 Comparator input pins
Comparator input and reference pins maybe be used as either digital I/O or as inputs to
the comparator. However, when selected as comparator input signals in CMPn lower
voltage limits apply. Please refer to the P89LPC980/982
data sheet
for specifications.
13.4 Comparator interrupt
Each comparator has an interrupt flag CMFn contained in its configuration register. This
flag is set whenever the comparator output changes state. The flag may be polled by
software or may be used to generate an interrupt. The two comparators use one common
interrupt vector. The interrupt will be generated when the interrupt enable bit EC in the
IEN1 register is set and the interrupt system is enabled via the EA bit in the IEN0 register.
If both comparators enable interrupts, after entering the interrupt service routine, the user
will need to read the flags to determine which comparator caused the interrupt.
When a comparator is disabled the comparator’s output, COx, goes high. If the
comparator output was low and then is disabled, the resulting transition of the comparator
output from a low to high state will set the comparator flag, CMFx. This will cause an
interrupt if the comparator interrupt is enabled. The user should therefore disable the
comparator interrupt prior to disabling the comparator. Additionally, the user should clear
the comparator flag, CMFx, after disabling the comparator.
13.5 Comparators and power reduction modes
Either or both comparators may remain enabled when Power-down mode or Idle mode is
activated, but both comparators are disabled automatically in Total Power-down mode.
If a comparator interrupt is enabled (except in Total Power-down mode), a change of the
comparator output state will generate an interrupt and wake-up the processor. If the
comparator output to a pin is enabled, the pin should be configured in the push-pull mode
in order to obtain fast switching times while in Power-down mode. The reason is that with
the oscillator stopped, the temporary strong pull-up that normally occurs during switching
on a quasi-bidirectional port pin does not take place.
6:4
REFS5:3 Reference Select for Comparator 2. These bits are used to select the internal
reference voltage for Comparator 2.
The following references for Comparator 2 are selected by reference bits
REFS[5:3]:
000 Bandgap voltage, Vref(bg), nominally 1.23 V
001 Vref_trip1, 0.875 V
DD
.
010 Vref_trip2, 0.750 V
DD
.
011 Vref_trip3, 0.625 V
DD
.
100 Vref_trip4, 0.500 V
DD
.
101 Vref_trip5, 0.375 V
DD
.
110 Vref_trip6, 0.250 V
DD
.
111 Vref_trip7, 0.125 V
DD
.
7
-
Reserved
Table 79.
Comparator Reference register (CMPREF - address FFCBh) bit description
Bit Symbol
Description