PIC16C620 Microchip Technology, PIC16C620 Datasheet - Page 39

no-image

PIC16C620

Manufacturer Part Number
PIC16C620
Description
EPROM-Based 8-Bit CMOS Microcontroller
Manufacturer
Microchip Technology
Datasheet

Available stocks

Company
Part Number
Manufacturer
Quantity
Price
Part Number:
PIC16C620-04/SS
Manufacturer:
MICROCHIP/微芯
Quantity:
20 000
Part Number:
PIC16C620-04I/P
Quantity:
8
Part Number:
PIC16C620/JW
Manufacturer:
MICROCH
Quantity:
20 000
Part Number:
PIC16C620A-04/P
Quantity:
19
Part Number:
PIC16C620A-04/P
Manufacturer:
MICROCHIP/微芯
Quantity:
20 000
Part Number:
PIC16C620A-04/SO
Manufacturer:
MICROCHI
Quantity:
84
Part Number:
PIC16C620A-04/SO
Manufacturer:
MICROCHIP/微芯
Quantity:
20 000
Part Number:
PIC16C620A-041/P
Quantity:
358
Part Number:
PIC16C620A-04I/P
Manufacturer:
MICROCHIP/微芯
Quantity:
20 000
Part Number:
PIC16C620A-04I/SS
Manufacturer:
Microchip Technology
Quantity:
135
Part Number:
PIC16C620A-40/P
Manufacturer:
Microchip Technology
Quantity:
135
The code example in Example 7-1 depicts the steps
required to configure the comparator module. RA3 and
RA4 are configured as digital output. RA0 and RA1 are
configured as the V- inputs and RA2 as the V+ input to
both comparators.
EXAMPLE 7-1:
7.2
A single comparator is shown in Figure 7-3 along with
the relationship between the analog input levels and
the digital output. When the analog input at V
than the analog input V
comparator is a digital low level. When the analog input
at V
of the comparator is a digital high level. The shaded
areas of the output of the comparator in Figure 7-3
represent the uncertainty due to input offsets and
response time.
FLAG_REG EQU
CLRF
CLRF
MOVF
ANDLW
IORWF
MOVLW
MOVWF
BSF
MOVLW
MOVWF
BCF
CALL
MOVF
BCF
BSF
BSF
BCF
BSF
BSF
1998 Microchip Technology Inc.
IN
+ is greater than the analog input V
Comparator Operation
FLAG_REG
PORTA
CMCON, W
0xC0
FLAG_REG,F
0x03
CMCON
STATUS,RP0
0x07
TRISA
STATUS,RP0
DELAY 10
CMCON,F
PIR1,CMIF
STATUS,RP0
PIE1,CMIE
STATUS,RP0
INTCON,PEIE ;Enable peripheral interrupts
INTCON,GIE
INITIALIZING
COMPARATOR MODULE
0X20
;Init flag register
;Init PORTA
;Load comparator bits
;Mask comparator bits
;Store bits in flag register
;Init comparator mode
;CM<2:0> = 011
;Select Bank1
;Initialize data direction
;Set RA<2:0> as inputs
;RA<4:3> as outputs
;TRISA<7:5> always read ‘0’
;Select Bank 0
;10 s delay
;Read CMCON to end change condition
;Clear pending interrupts
;Select Bank 1
;Enable comparator interrupts
;Select Bank 0
;Global interrupt enable
IN
–, the output of the
IN
–, the output
IN
+ is less
Preliminary
7.3
An external or internal reference signal may be used
depending on the comparator operating mode. The
analog signal that is present at V
signal at V
is adjusted accordingly (Figure 7-3).
FIGURE 7-3:
7.3.1
When external voltage references are used, the
comparator module can be configured to have the com-
parators operate from the same or different reference
sources. However, threshold detector applications may
require the same reference. The reference signal must
be between V
pin of the comparator(s).
7.3.2
The comparator module also allows the selection of an
internally
comparators. Section 13, Instruction Sets, contains a
detailed description of the Voltage Reference Module
that provides this signal. The internal reference signal
is used when the comparators are in mode
CM<2:0>=010 (Figure 7-2). In this mode, the internal
voltage reference is applied to the V
parators.
Output
V
V
IN–
IN+
V
V
IN
IN
Comparator Reference
EXTERNAL REFERENCE SIGNAL
INTERNAL REFERENCE SIGNAL
+
IN
generated
+, and the digital output of the comparator
SS
and V
SINGLE COMPARATOR
+
DD
voltage
PIC16C62X
, and can be applied to either
IN
– is compared to the
reference
IN
DS30235G-page 39
+ pin of both com-
Output
for
the

Related parts for PIC16C620