AN1740 Freescale Semiconductor / Motorola, AN1740 Datasheet - Page 8

no-image

AN1740

Manufacturer Part Number
AN1740
Description
Applications Using the Analog Subsystem on MC68HC05JJ/JP Series Microcontrollers
Manufacturer
Freescale Semiconductor / Motorola
Datasheet
Freescale Semiconductor, Inc.
Application Note
CMP1 or CPF1 bits or use an analog interrupt that is generated when
the CPF1 bit is set.
Comparator 1 also has the provision to connect its output to the PB4 pin
by setting the COE1 bit in the ASR. This makes this comparator useful
for directly driving some external function. (The use of the COE1 bit is
enabled by the OPT mask option.)
The connections to PB2, PB3, and PB4 mean that the user must decide
the dominant use of these pins. While the inputs to comparator 1 will not
affect the levels applied to PB2 and PB3 (even if above the common-
mode range of comparator 2), the output of comparator 1 can be OR’ed
with any internal source driving PB4. Comparator 1 can be used in a
variety of configurations which are described in the following paragraphs
and shown in
Figure
3.
Case 1 uses comparator 1 as a simple function to detect when the
voltage on PB2 rises above PB3. In this case, port B would be
configured with PB2 and PB3 as inputs. Normally, the user would
deactivate the input pulldowns on PB2 or PB3, but there is no internal
reason that they could not remain active if the external voltage sources
can supply up to 300 A. A software subroutine can then be initiated by
polling the state of the CMP1 output bit or the CPF1 flag bit or by an
analog interrupt caused by CPF1 being set.
Case 2 uses comparator 1 solely for an outside function. In this case, the
user should configure the PB2 and PB3 pins to be inputs with their
pulldowns deactivated and the PB4 pin as an output. The COE1 bit
should be set with both the OLVL and PB4 data bit cleared.
Case 3 uses comparator 1 as an additional detection means for another
MCU pin. As in case 2, the PB2 and PB3 pins should be configured as
inputs with their pulldowns deactivated and the PB4 pin as an output.
The COE1 bit should be set with both the OLVL and PB4 data bit
cleared. The comparator’s output can then be wrapped around from the
PB4 pin to the RESET, IRQ, or a port A pin which has IRQ capability
(PA0:PA3). This essentially creates an adjustable threshold for resetting
the MCU or causing an IRQ interrupt. Possible uses would be low
battery detection, level alarms, and low-voltage reset. If the comparator
1 output drives the IRQ function, the additional IRQ source can be made
AN1740
8
MOTOROLA
For More Information On This Product,
Go to: www.freescale.com

Related parts for AN1740