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

PIC16F886-I/SS 参数 Datasheet PDF下载

PIC16F886-I/SS图片预览
型号: PIC16F886-I/SS
PDF下载: 下载PDF文件 查看货源
内容描述: 28 /40/ 44引脚,增强基于闪存的8位CMOS微控制器采用纳瓦技术 [28/40/44-Pin, Enhanced Flash-Based 8-Bit CMOS Microcontrollers with nanoWatt Technology]
分类和应用: 闪存微控制器和处理器外围集成电路光电二极管时钟
文件页数/大小: 288 页 / 5120 K
品牌: MICROCHIP [ MICROCHIP ]
 浏览型号PIC16F886-I/SS的Datasheet PDF文件第101页浏览型号PIC16F886-I/SS的Datasheet PDF文件第102页浏览型号PIC16F886-I/SS的Datasheet PDF文件第103页浏览型号PIC16F886-I/SS的Datasheet PDF文件第104页浏览型号PIC16F886-I/SS的Datasheet PDF文件第106页浏览型号PIC16F886-I/SS的Datasheet PDF文件第107页浏览型号PIC16F886-I/SS的Datasheet PDF文件第108页浏览型号PIC16F886-I/SS的Datasheet PDF文件第109页  
PIC16F882/883/884/886/887  
9.2.6  
A/D CONVERSION PROCEDURE  
EXAMPLE 9-1:  
A/D CONVERSION  
;This code block configures the ADC  
;for polling, Vdd and Vss as reference, Frc  
clock and AN0 input.  
;
This is an example procedure for using the ADC to  
perform an Analog-to-Digital conversion:  
1. Configure Port:  
• Disable pin output driver (See TRIS register)  
• Configure pin as analog  
;Conversion start & polling for completion  
; are included.  
;
2. Configure the ADC module:  
• Select ADC conversion clock  
• Configure voltage reference  
• Select ADC input channel  
• Select result format  
BANKSEL  
MOVLW  
MOVWF  
BANKSEL  
BSF  
BANKSEL  
BSF  
BANKSEL  
MOVLW  
MOVWF  
CALL  
BSF  
BTFSC  
GOTO  
BANKSEL  
MOVF  
MOVWF  
BANKSEL  
MOVF  
ADCON1  
;
B’10000000’ ;right justify  
ADCON1  
TRISA  
TRISA,0  
ANSEL  
ANSEL,0  
ADCON0  
B’11000001’ ;ADC Frc clock,  
ADCON0  
SampleTime  
ADCON0,GO  
ADCON0,GO  
$-1  
;Vdd and Vss as Vref  
;
;Set RA0 to input  
;
;Set RA0 to analog  
;
• Turn on ADC module  
3. Configure ADC interrupt (optional):  
• Clear ADC interrupt flag  
;AN0, On  
• Enable ADC interrupt  
;Acquisiton delay  
;Start conversion  
;Is conversion done?  
;No, test again  
;
;Read upper 2 bits  
;store in GPR space  
;
• Enable peripheral interrupt  
• Enable global interrupt(1)  
4. Wait the required acquisition time(2)  
.
ADRESH  
ADRESH,W  
RESULTHI  
ADRESL  
ADRESL,W  
RESULTLO  
5. Start conversion by setting the GO/DONE bit.  
6. Wait for ADC conversion to complete by one of  
the following:  
;Read lower 8 bits  
;Store in GPR space  
• Polling the GO/DONE bit  
MOVWF  
• Waiting for the ADC interrupt (interrupts  
enabled)  
7. Read ADC Result  
8. Clear the ADC interrupt flag (required if interrupt  
is enabled).  
Note 1: The global interrupt can be disabled if the  
user is attempting to wake-up from Sleep  
and resume in-line code execution.  
2: See Section 9.3 “A/D Acquisition  
Requirements”.  
© 2007 Microchip Technology Inc.  
Preliminary  
DS41291D-page 103  
 复制成功!