DatasheetQ Logo
Electronic component search and free download site. Transistors,MosFET ,Diode,Integrated circuits

PIC16C717-I/SS View Datasheet(PDF) - Microchip Technology

Part Name
Description
Manufacturer
PIC16C717-I/SS Datasheet PDF : 200 Pages
First Prev 111 112 113 114 115 116 117 118 119 120 Next Last
PIC16C717/770/771
11.4 A/D Conversions
Example 11-1 shows an example that performs an A/D
conversion. The port pins are configured as analog
inputs. The analog reference VREF+ is the device AVDD
and the analog reference VREF- is the device AVSS. The
A/D interrupt is enabled and the A/D conversion clock
is TRC. The conversion is performed on the AN0
channel.
EXAMPLE 11-1: PERFORMING AN A/D CONVERSION
BCF
PIR1, ADIF
;Clear A/D Int Flag
BSF
STATUS, RP0 ;Select Bank 1
CLRF ADCON1
;Configure A/D Voltage Reference
MOVLW 0x01
MOVWF ANSEL
;disable AN0 digital input buffer
MOVWF TRISA
;RA0 is input mode
BSF
PIE1, ADIE
;Enable A/D interrupt
BCF
STATUS, RP0 ;Select Bank 0
MOVLW 0xC1
;RC clock, A/D is on,
;Ch 0 is selected
MOVWF ADCON0
;
BSF
INTCON, PEIE ;Enable Peripheral
BSF
INTCON, GIE ;Enable All Interrupts
;
; Ensure that the required sampling time for the
; selected input channel has lapsed. Then the
; conversion may be started.
BSF
ADCON0, GO
;Start A/D Conversion
:
;The ADIF bit will be
;set and the GO/DONE bit
:
;cleared upon completion-
;of the A/D conversion.
; Wait for A/D completion and read ADRESH:ADRESL for result.
© 1999 Microchip Technology Inc.
Advanced Information
DS41120A-page 119

Share Link: 

datasheetq.com  [ Privacy Policy ]Request Datasheet ] [ Contact Us ]