;----------------------------------------
; Analog-to-Digital Converter (A/D) Module (Section 7.0) (PIC12F675 Only)
;
; The analog-to-digital converter (A/D) allows conversion of an analog
; input signal to a 10-bit binary representation of that signal. The
; PIC12F675 has four analog inputs multiplexed into one sample and hold
; circuit. There are two registers to control the functions of the A/D
; module:
; A/D Control Register (ADCON0)
; Analog Select Register (ANSEL)
;
; Note: When using GPIO pins as analog inputs, ensure the TRISIO register
; bits are set (= 1) for input.
; Ports= xxx4x210
movlw b'00000100' ; Enable AN2 with A/D Clk = Fosc/8
movwf ANSEL
; VRCON (Register 6-2)
clrf VRCON ; CVref circuit: powered down, no Idd drain
bcf STATUS, RP0 ; ---- Select Bank 0 -----
movlw b'00001000' ; left justified, Vdd ref, A/D off
movwf ADCON0
bsf ADCON0,ADON ; A/D On
clrf T1CON
bsf T1CON,0 ; timer 1 on
bcf PIR1,TMR1IF ; clear timer 1 overflow
TIME_0
bcf INTCON,T0IF