HT66F016/HT66F017/HT68F016/HT68F017
HT66F016R/HT66F017R/HT68F016R/HT68F017R
Comparators
An analog comparator is contained within these de-
vices. These functions offer flexibility via their register
controlled features such as power-down, polarity select,
hysteresis etc. In sharing their pins with normal I/O pins
the comparators do not waste precious I/O pins if there
functions are otherwise unused.
CPO L
COUT
C+
CX
C-
CSEL
Comparator
Comparator Operation
The device contains a comparator function which is
used to compare two analog voltages and provide an
output based on their difference. Full control over the in-
ternal comparators is provided via the control register
CPC assigned to the comparator. The comparator out-
put is recorded via a bit in the control register, but can
also be transferred out onto a shared I/O pin. Additional
comparator functions include, output polarity, hysteresis
functions and power down control.
Any pull-high resistors connected to the shared com-
parator input pins will be automatically disconnected
when the comparator is enabled. As the comparator in-
puts approach their switching level, some spurious out-
put signals may be generated on the comparator output
due to the slow rising or falling nature of the input sig-
nals. This can be minimised by selecting the hysteresis
function will apply a small amount of positive feedback
to the comparator. Ideally the comparator should switch
at the point where the positive and negative inputs sig-
nals are at the same voltage level, however, unavoid-
able input offsets introduce some uncertainties here.
The hysteresis function, if enabled, also increases the
switching offset value.
Comparator Interrupt
The comparator possesses its own interrupt function.
When the comparator output changes state, its relevant
interrupt flag will be set, and if the corresponding inter-
rupt enable bit is set, then a jump to its relevant interrupt
vector will be executed. Note that it is the changing state
of the COUT bit and not the output pin which generates
an interrupt. If the microcontroller is in the SLEEP or
IDLE Mode and the Comparator is enabled, then if the
external input lines cause the Comparator output to
change state, the resulting generated interrupt flag will
also generate a wake-up. If it is required to disable a
wake-up from occurring, then the interrupt flag should
be first set high before entering the SLEEP or IDLE
Mode.
Programming Considerations
If the comparator is enabled, it will remain active when
the microcontroller enters the SLEEP or IDLE Mode,
however as it will consume a certain amount of power,
the user may wish to consider disabling it before the
SLEEP or IDLE Mode is entered.
As comparator pins are shared with normal I/O pins the
I/O registers for these pins will be read as zero (port con-
trol register is ²1²) or read as port data register value
(port control register is ²0²) if the comparator function is
enabled.
Rev. 1.40
82
November 22, 2016