English
Language : 

PIC16F882-I Datasheet, PDF (94/328 Pages) Microchip Technology – 28/40/44-Pin, Enhanced Flash-Based 8-Bit CMOS Microcontrollers
PIC16F882/883/884/886/887
8.9 Comparator SR Latch
The SR latch module provides additional control of the
comparator outputs. The module consists of a single
SR latch and output multiplexers. The SR latch can be
set, reset or toggled by the comparator outputs. The SR
latch may also be set or reset, independent of
comparator output, by control bits in the SRCON control
register. The SR latch output multiplexers select
whether the latch outputs or the comparator outputs are
directed to the I/O port logic for eventual output to a pin.
8.9.1 LATCH OPERATION
The latch is a Set-Reset latch that does not depend on a
clock source. Each of the Set and Reset inputs are
active-high. Each latch input is connected to a
comparator output and a software controlled pulse
generator. The latch can be set by C1OUT or the PULSS
bit of the SRCON register. The latch can be reset by
C2OUT or the PULSR bit of the SRCON register. The
latch is reset-dominant, therefore, if both Set and Reset
inputs are high the latch will go to the Reset state. Both
the PULSS and PULSR bits are self resetting which
means that a single write to either of the bits is all that is
necessary to complete a latch set or Reset operation.
8.9.2 LATCH OUTPUT
The SR<1:0> bits of the SRCON register control the
latch output multiplexers and determine four possible
output configurations. In these four configurations, the
CxOUT I/O port logic is connected to:
• C1OUT and C2OUT
• C1OUT and SR latch Q
• C2OUT and SR latch Q
• SR latch Q and Q
After any Reset, the default output configuration is the
unlatched C1OUT and C2OUT mode. This maintains
compatibility with devices that do not have the SR latch
feature.
The applicable TRIS bits of the corresponding ports
must be cleared to enable the port pin output drivers.
Additionally, the CxOE comparator output enable bits of
the CMxCON0 registers must be set in order to make the
comparator or latch outputs available on the output pins.
The latch configuration enable states are completely
independent of the enable states for the comparators.
FIGURE 8-7:
SR LATCH SIMPLIFIED BLOCK DIAGRAM
PULSS
Pulse
Gen(2)
C1OUT (from comparator)
C1SEN
SYNCC2OUT (from comparator)
C2REN
PULSR
Pulse
Gen(2)
SQ
SR
Latch(1)
RQ
SR0
0
MUX
1
C1OE
C1OUT pin(3)
1
MUX
0
SR1
C2OE
C2OUT pin(3)
Note 1:
2:
3:
If R = 1 and S = 1 simultaneously, Q = 0, Q = 1
Pulse generator causes a 1/2 Q-state (1 Tosc) pulse width.
Output shown for reference only. See I/O port pin block diagram for more detail.
DS41291F-page 92
© 2009 Microchip Technology Inc.