欢迎访问ic37.com |
会员登录 免费注册
发布采购

PIC16F628-04/SS 参数 Datasheet PDF下载

PIC16F628-04/SS图片预览
型号: PIC16F628-04/SS
PDF下载: 下载PDF文件 查看货源
内容描述: 基于闪存的8位CMOS微控制器 [FLASH-Based 8-Bit CMOS Microcontrollers]
分类和应用: 闪存微控制器
文件页数/大小: 160 页 / 1657 K
品牌: MICROCHIP [ MICROCHIP ]
 浏览型号PIC16F628-04/SS的Datasheet PDF文件第55页浏览型号PIC16F628-04/SS的Datasheet PDF文件第56页浏览型号PIC16F628-04/SS的Datasheet PDF文件第57页浏览型号PIC16F628-04/SS的Datasheet PDF文件第58页浏览型号PIC16F628-04/SS的Datasheet PDF文件第60页浏览型号PIC16F628-04/SS的Datasheet PDF文件第61页浏览型号PIC16F628-04/SS的Datasheet PDF文件第62页浏览型号PIC16F628-04/SS的Datasheet PDF文件第63页  
PIC16F62X  
The code example in Example 9-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.  
9.3  
Comparator Reference  
An external or internal reference signal may be used  
depending on the comparator operating mode. The  
analog signal that is present at VIN– is compared to the  
signal at VIN+, and the digital output of the comparator  
is adjusted accordingly (Figure 9-2).  
EXAMPLE 9-1: INITIALIZING  
COMPARATOR MODULE  
FIGURE 9-2: SINGLE COMPARATOR  
FLAG_REG EQU  
0X20  
CLRF  
CLRF  
FLAG_REG  
PORTA  
;Init flag register  
;Init PORTA  
MOVF  
CMCON, W  
0xC0  
;Load comparator bits  
;Mask comparator bits  
VIN+  
+
ANDLW  
IORWF  
MOVLW  
MOVWF  
BSF  
Output  
FLAG_REG,F ;Store bits in flag register  
0x03  
CMCON  
VIN–  
;Init comparator mode  
;CM<2:0> = 011  
STATUS,RP0 ;Select Bank1  
MOVLW  
MOVWF  
0x07  
TRISA  
;Initialize data direction  
;Set RA<2:0> as inputs  
;RA<4:3> as outputs  
V
IN–  
IN+  
;TRISA<7:5> always read ‘0’  
STATUS,RP0 ;Select Bank 0  
BCF  
CALL  
MOVF  
BCF  
BSF  
BSF  
BCF  
BSF  
BSF  
DELAY 10  
CMCON,F  
PIR1,CMIF  
;10µs delay  
;Read CMCONtoendchangecondition  
;Clear pending interrupts  
V
STATUS,RP0 ;Select Bank 1  
PIE1,CMIE  
;Enable comparator interrupts  
STATUS,RP0 ;Select Bank 0  
INTCON,PEIE ;Enable peripheral interrupts  
INTCON,GIE ;Global interrupt enable  
Output  
9.2  
Comparator Operation  
9.3.1  
EXTERNAL REFERENCE SIGNAL  
A single comparator is shown in Figure 9-2 along with  
the relationship between the analog input levels and  
the digital output. When the analog input at VIN+ is less  
than the analog input VIN–, the output of the  
comparator is a digital low level. When the analog input  
at VIN+ is greater than the analog input VIN–, the output  
of the comparator is a digital high level. The shaded  
areas of the output of the comparator in Figure 9-2  
represent the uncertainty due to input offsets and  
response time.  
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 VSS and VDD, and can be applied to either  
pin of the comparator(s).  
9.3.2  
INTERNAL REFERENCE SIGNAL  
The comparator module also allows the selection of an  
internally generated voltage reference for the  
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 9-1). In this mode, the internal  
voltage reference is applied to the VIN+ pin of both  
comparators.  
1999 Microchip Technology Inc.  
Preliminary  
DS40300B-page 59  
 
 
 复制成功!