banksel ANSEL
movlw b'00000011'; prepare to set bits A0,A1 to analog.
movwf ANSEL; apply a/d input settings - PORTA
clrf ANSELH; PORTB all digital
Banksel TRISA
movlw b'10000011' ; set bits ,0,1,7 as inputs, rest as outs. 7 is Sw1 digital
movwf TRISA
bsf TRISE,3; make E3 (IC pin1) an input- sw0 digital
clrf TRISB ; Portb all outs.
CLRF TRISC ; make portC outputs
movlw b'01111100'
movwf OSCCON ; set 8Mhz, Osc setup based on config fuses .
banksel ADCON1
clrf ADCON1; left justify ADRESH, Vdd & Vss as Vrefs.
banksel ADCON0
clrf ADCON0
bsf ADCON0,7 ; set sample period to 4 us (8 instruction cycles) @ 8Mhz, An0 is input.
BankSel HoldL ; back to general variable bank