Electronic Components Datasheet Search
  English  ▼

X  

PIC16F785 Datasheet(PDF) 69 Page - Microchip Technology

Part # PIC16F785
Description  20-Pin Flash-Based 8-Bit CMOS Microcontroller with Two-Phase Asychronous Feedback PWM, Dual High-Speed Comparators and Dual Operational Amplifiers
PDF  178 Pages
Scroll/Zoom Zoom In 100%  Zoom Out
Manufacturer  MICROCHIP [Microchip Technology]
Direct Link  http://www.microchip.com
Logo MICROCHIP - Microchip Technology

PIC16F785 Datasheet(HTML) 69 Page - Microchip Technology

Back Button PIC16F785 Datasheet HTML 65Page - Microchip Technology PIC16F785 Datasheet HTML 66Page - Microchip Technology PIC16F785 Datasheet HTML 67Page - Microchip Technology PIC16F785 Datasheet HTML 68Page - Microchip Technology PIC16F785 Datasheet HTML 69Page - Microchip Technology PIC16F785 Datasheet HTML 70Page - Microchip Technology PIC16F785 Datasheet HTML 71Page - Microchip Technology PIC16F785 Datasheet HTML 72Page - Microchip Technology PIC16F785 Datasheet HTML 73Page - Microchip Technology Next Button
Zoom Inzoom in Zoom Outzoom out
 69 / 178 page
background image
 2004 Microchip Technology Inc.
Preliminary
DS41249A-page 67
PIC16F785
9.2
Comparator Outputs
The comparator outputs are read through the
CM1CON0, COM2CON0 or CM2CON1 registers.
CM1CON0 and CM2CON0 each contain the individ-
ual comparator output of comparator 1 and compara-
tor 2, respectively. CM2CON2 contains a mirror copy
of both comparator outputs facilitating a simultaneous
read of both comparators. These bits are read-only.
The comparator outputs may also be directly output to
the
RA2/AN2/T0CKI/INT/C1OUT
and
RC4/C2OUT/PH2 I/O pins. When enabled, multiplex-
ers in the output path of the RA2 and RC4 pins will
switch and the output of each pin will be the unsyn-
chronized output of the comparator. The uncertainty of
each of the comparators is related to the input offset
voltage and the response time given in the specifica-
tions. Figure 9-1 and Figure 9-2 show the output block
diagrams for Comparators 1 and 2, respectively.
The TRIS bits will still function as an output
enable/disable for the RA2/AN2/T0CKI/INT/C1OUT
and RC4/C2OUT/PH2 pins while in this mode.
The polarity of the comparator outputs can be changed
using the C1POL and C2POL bits (CMxCON0<4>).
Timer1 gate source can be configured to use the T1G
pin or Comparator 2 output as selected by the T1GSS
bit (CM2CON1<1>). The Timer1 gate feature can be
used to time the duration or interval of analog events.
The output of Comparator 2 can also be synchronized
with
Timer1
by
setting
the
C2SYNC
bit
(CM2CON1<0>). When enabled, the output of Com-
parator 2 is latched on the falling edge of Timer1 clock
source. If a prescaler is used with Timer1, Comparator
2 is latched after the prescaler. To prevent a race con-
dition, the Comparator 2 output is latched on the falling
edge of the Timer1 clock source and Timer1 incre-
ments on the rising edge of its clock source. See the
Comparator 2 Block Diagram (Figure 9-2) and the
Timer1 Block Diagram (Figure 6-1) for more informa-
tion.
It is recommended to synchronize Comparator 2 with
Timer1 by setting the C2SYNC bit when Comparator 2
is used as the Timer1 gate source. This ensures Timer1
does not miss an increment if Comparator 2 changes
during an increment.
9.3
Comparator Interrupts
The comparator interrupt flags are set whenever there
is a change in the output value of its respective compar-
ator. Software will need to maintain information about
the
status
of
the
output
bits,
as
read
from
CM2CON0<7:6>, to determine the actual change that
has occurred. The CxIF bits, PIR1<4:3>, are the
Comparator Interrupt Flags. Each comparator interrupt
bit must be reset in software by clearing it to ‘0’. Since
it is also possible to write a ‘1’ to this register, a simu-
lated interrupt may be initiated.
The
CxIE
bits
(PIE1<4:3>)
and
the
PEIE
bit
(INTCON<6>) must be set to enable the interrupts. In
addition, the GIE bit must also be set. If any of these
bits are cleared, the interrupt is not enabled, though the
CxIF bits will still be set if an interrupt condition occurs.
The comparator interrupt of the PIC16F785 differs from
previous designs in that the interrupt flag is set by the
mismatch edge and not the mismatch level. This
means that the interrupt flag can be reset without the
additional step of reading or writing the CMxCON0
register to clear the mismatch registers. When the
mismatch registers are not cleared, an interrupt will not
occur when the comparator output returns to the
previous state. When the mismatch registers are
cleared, an interrupt will occur when the comparator
returns to the previous state.
9.4
Effects of RESET
A RESET forces all registers to their RESET state. This
disables both comparators.
Note 1: If a change in the CMxCON0 register
(CxOUT) should occur when a read
operation is being executed (start of the
Q2 cycle), then the CxIF (PIR1<4:3>)
interrupt flag may not get set.
2: When either comparator is first enabled,
bias circuitry in the comparator module
may cause an invalid output from the
comparator until the bias circuitry is sta-
ble. Allow about 1
µs for bias settling then
clear the mismatch condition and inter-
rupt flags before enabling comparator
interrupts.



Html Pages

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100  ...More


Datasheet Download

Go To PDF Page


Link URL



Does ALLDATASHEET help your business so far?  [ DONATE ] 

About Alldatasheet   |   Advertisement   |   Contact us   |   Privacy Policy   |   Link to Datasheet    |   Link Exchange   |   Manufacturer List
All Rights Reserved©Alldatasheet.com


Mirror Sites
English : Alldatasheet.com  |   English : Alldatasheet.net  |   Chinese : Alldatasheetcn.com  |   German : Alldatasheetde.com  |   Japanese : Alldatasheet.jp
Russian : Alldatasheetru.com  |   Korean : Alldatasheet.co.kr  |   Spanish : Alldatasheet.es  |   French : Alldatasheet.fr  |   Italian : Alldatasheetit.com
Portuguese : Alldatasheetpt.com  |   Polish : Alldatasheet.pl  |   Vietnamese : Alldatasheet.vn
Indian : Alldatasheet.in  |   Mexican : Alldatasheet.com.mx  |   British : Alldatasheet.co.uk  |   New Zealand : Alldatasheet.co.nz
Family Site : ic2ic.com  |   icmetro.com