PIC16C770 Microchip Technology Inc., PIC16C770 Datasheet - Page 113

no-image

PIC16C770

Manufacturer Part Number
PIC16C770
Description
18/20-pin, 8-bit Cmos Microcontrollers With 10/12-bit A/d
Manufacturer
Microchip Technology Inc.
Datasheet
11.4
Example 11-1 shows an example that performs an A/D
conversion. The port pins are configured as analog
inputs. The analog reference V
and the analog reference V
The A/D interrupt is enabled and the A/D conversion
clock is T
channel.
EXAMPLE 11-1: PERFORMING AN A/D CONVERSION
;
; Ensure that the required sampling time for the
; selected input channel has lapsed. Then the
; conversion may be started.
; Wait for A/D completion and read ADRESH:ADRESL for result.
2002 Microchip Technology Inc.
BSF
CLRF
MOVLW
MOVWF
MOVWF
BSF
BCF
MOVLW
MOVWF
BCF
BSF
BSF
BSF
A/D Conversions
RC
. The conversion is performed on the AN0
STATUS, RP0
ADCON1
0x01
ANSEL
TRISA
PIE1, ADIE
STATUS, RP0
0xC1
ADCON0
PIR1, ADIF
INTCON, PEIE
INTCON, GIE
ADCON0, GO
:
:
REF
REF
;Select Bank 1
;Configure A/D Voltage Reference
;disable AN0 digital input buffer
;RA0 is input mode
;Enable A/D interrupt
;Select Bank 0
;RC clock, A/D is on,
;Ch 0 is selected
;
;Clear A/D Int Flag
;Enable Peripheral
;Enable All Interrupts
;Start A/D Conversion
;The ADIF bit will be
;set and the GO/DONE bit
;cleared upon completion-
;of the A/D conversion.
- is the device AV
+ is the device AV
SS
DD
.
PIC16C717/770/771
DS41120B-page 111

Related parts for PIC16C770