2 internal reference voltage, 3 comparator input pins, 4 comparator interrupt – NXP Semiconductors P89LPC9321 UM10310 User Manual

Page 96: N in, Figure 46, Nxp semiconductors

Advertising
background image

UM10310

All information provided in this document is subject to legal disclaimers.

© NXP B.V. 2010. All rights reserved.

User manual

Rev. 2 — 1 November 2010

96 of 139

NXP Semiconductors

UM10310

P89LPC9321 User manual

13.2 Internal

reference

voltage

An internal reference voltage, V

ref(bg)

, may supply a default reference when a single

comparator input pin is used. Please refer to the P89LPC9321 data sheet for
specifications.

13.3 Comparator input pins

Comparator input and reference pins maybe be used as either digital I/O or as inputs to
the comparator. When used as digital I/O these pins are 5 V tolerant. However, when
selected as comparator input signals in CMPn lower voltage limits apply. Please refer to
the P89LPC9321 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.

Fig 46. Comparator input and output connections.

comparator 1

CP1

CN1

(P0.4) CIN1A

(P0.3) CIN1B

(P0.5) CMPREF

V

ref(bg)

OE1

change detect

CO1

CMF1

inter

002aad561

CMP1 (P0.6)

EC

change detect

CMF2

comparator 2

OE2

CO2

CMP2 (P0.0)

CP2

CN2

(P0.2) CIN2A

(P0.1) CIN2B

PGA1

Advertising