PIC16F785-I/P Microchip Technology Inc., PIC16F785-I/P Datasheet - Page 68

no-image

PIC16F785-I/P

Manufacturer Part Number
PIC16F785-I/P
Description
MCU, 8-Bit, 2KW Flash, 128 RAM, 18 I/O, DIP-20
Manufacturer
Microchip Technology Inc.
Datasheet

Specifications of PIC16F785-I/P

A/d Inputs
12-Channel, 10-Bit
Comparators
2
Cpu Speed
5 MIPS
Eeprom Memory
256 Bytes
Input Output
17
Memory Type
Flash
Number Of Bits
8
Package Type
20-pin PDIP
Programmable Memory
3.5K Bytes
Ram Size
128 Bytes
Speed
20 MHz
Timers
2-8-bit, 1-16-bit
Voltage, Range
2-5.5 V
Lead Free Status / Rohs Status
RoHS Compliant part Electrostatic Device
PIC16F785/HV785
9.1.2
The CM2CON0 register is a functional copy of the
CM1CON0 register described in Section 9.1.1 “Com-
parator C1 Control Register”. A second control regis-
ter, CM2CON1, is also present for control of an
additional synchronizing feature, as well as mirrors of
both comparator outputs.
9.1.2.1
The CM2CON0 register, shown in Register 9-2,
contains the control and Status bits for Comparator C2.
Setting C2ON (CM2CON0<7>) enables Comparator
C2 for operation.
Bits
comparator input from the four analog pins, AN<7:5,1>.
C2R (CM2CON0<2>) selects the reference to be used
with the comparator. Setting C2R (CM2CON0<2>)
selects the C2V
reference module as the reference voltage for the
comparator. Clearing C2R selects the C2IN+ input on
the RC0/AN4/C2IN+ pin.
The output of the comparator is available internally via
the C2OUT bit (CM2CON0<6>). To make the output
available for an external connection, the C2OE bit
(CM2CON0<5>) must be set.
FIGURE 9-2:
DS41249D-page 66
RA1/AN1/C12IN0-/V
Note:
Note
C2CH<1:0>
1:
2:
3:
RC2/AN6/C12IN2-/OP2
RC3/AN7/C12IN3-/OP1
RC1/AN5/C12IN1-/PH1
COMPARATOR C2 CONTROL
REGISTERS
To use AN<7:5,1> as analog inputs, the
appropriate bits must be programmed to 1
in the ANSEL0 register.
Control Register CM2CON0
When C2ON = 0, the C2 comparator will produce a ‘0’ output to the XOR Gate.
Timer1 gate control (see Figure 6-1).
Output shown for reference only. For more detail, see Figure 4-13.
RC0/AN4/C2IN+
REF
REF
output of the comparator voltage
(CM2CON0<1:0>)
COMPARATOR C2 SIMPLIFIED BLOCK DIAGRAM
/ICSPCLK
C2V
C2CH<1:0>
REF
C2R
0
1
0
1
2
3
MUX
MUX
2
select
C2VN
C2VP
Preliminary
the
C2
C2ON
C2POL
C2SP
(1)
From TMR1
The comparator output, C2OUT, can be inverted by
setting the C2POL bit (CM2CON0<4>). Clearing
C2POL results in a non-inverted output.
A complete table showing the output state versus input
conditions and the polarity bit is shown in Table 9-2.
TABLE 9-2:
C2SP (CM2CON0<3>) configures the speed of the
comparator. When C2SP is set, the comparator
operates at its normal speed. Clearing C2SP operates
the comparator in low-power mode.
Input Condition
Note 1: The internal output of the comparator is
Clock
C2VN > C2VP
C2VN < C2VP
C2VN > C2VP
C2VN < C2VP
Q3*RD_CM2CON0
2: The C2 interrupt will operate correctly
3: For C2 output on RC4/C2OUT/PH2:
Q1
latched at the end of each instruction
cycle. External outputs are not latched.
with C2OE set or cleared. An external
output is not required for the C2 interrupt.
(C2OE = 1) and (C2ON = 1) and
(TRISA<4> = 0).
D
NRESET
C2OUT
D
EN
Q
C2 OUTPUT STATE VERSUS
INPUT CONDITIONS
Q
C2SYNC
D
EN
C2POL
CL
C2POL
0
1
© 2006 Microchip Technology Inc.
MUX
Q
0
0
1
1
RD_CM2CON0
RC4/C2OUT/PH2
SYNCC2OUT
C20E
To PWM Logic
C2OUT
0
1
1
0
Data Bus
Set C2IF
(2)
To
(3)

Related parts for PIC16F785-I/P