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

PIC16F722-I/SS 参数 Datasheet PDF下载

PIC16F722-I/SS图片预览
型号: PIC16F722-I/SS
PDF下载: 下载PDF文件 查看货源
内容描述: 28 /40/ 44引脚闪存单片机采用纳瓦XLP技术 [28/40/44-Pin Flash Microcontrollers with nanoWatt XLP Technology]
分类和应用: 闪存微控制器
文件页数/大小: 302 页 / 4540 K
品牌: MICROCHIP [ MICROCHIP ]
 浏览型号PIC16F722-I/SS的Datasheet PDF文件第99页浏览型号PIC16F722-I/SS的Datasheet PDF文件第100页浏览型号PIC16F722-I/SS的Datasheet PDF文件第101页浏览型号PIC16F722-I/SS的Datasheet PDF文件第102页浏览型号PIC16F722-I/SS的Datasheet PDF文件第104页浏览型号PIC16F722-I/SS的Datasheet PDF文件第105页浏览型号PIC16F722-I/SS的Datasheet PDF文件第106页浏览型号PIC16F722-I/SS的Datasheet PDF文件第107页  
PIC16F72X/PIC16LF72X  
9.2.6  
A/D CONVERSION PROCEDURE  
EXAMPLE 9-1:  
A/D CONVERSION  
This is an example procedure for using the ADC to  
perform an Analog-to-Digital conversion:  
;This code block configures the ADC  
;for polling, Vdd reference, Frc clock  
;and AN0 input.  
;
1. Configure Port:  
• Disable pin output driver (Refer to the TRIS  
register)  
;Conversion start & polling for completion  
; are included.  
;
• Configure pin as analog (Refer to the ANSEL  
register)  
BANKSEL  
MOVLW  
ADCON1  
;
B’01110000;ADC Frc clock,  
;VDD reference  
2. Configure the ADC module:  
• Select ADC conversion clock  
• Configure voltage reference  
• Select ADC input channel  
• Turn on ADC module  
MOVWF  
BANKSEL  
BSF  
BANKSEL  
BSF  
BANKSEL  
MOVLW  
MOVWF  
CALL  
BSF  
BTFSC  
GOTO  
BANKSEL  
MOVF  
MOVWF  
ADCON1  
TRISA  
TRISA,0  
ANSELA  
ANSELA,0  
ADCON0  
B’00000001’;AN0, On  
ADCON0  
SampleTime ;Acquisiton delay  
ADCON0,GO ;Start conversion  
ADCON0,GO ;Is conversion done?  
;
;
;Set RA0 to input  
;
;Set RA0 to analog  
;
3. Configure ADC interrupt (optional):  
• Clear ADC interrupt flag  
;
• Enable ADC interrupt  
• Enable peripheral interrupt  
• Enable global interrupt(1)  
$-1  
;No, test again  
;
;Read result  
;store in GPR space  
4. Wait the required acquisition time(2)  
.
ADRES  
ADRES,W  
RESULT  
5. Start conversion by setting the GO/DONE bit.  
6. Wait for ADC conversion to complete by one of  
the following:  
• Polling the GO/DONE bit  
• 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: Refer to Section 9.3 “A/D Acquisition  
Requirements”.  
© 2009 Microchip Technology Inc.  
DS41341E-page 103