All you need to set is ADCON0.7 = 1 for right justification. PBP will
handle channel select bits and ADON.
Try this.
Assuming you have your config fuse options & oscillator setupCode:DEFINE ADC_BITS 10 DEFINE ADC_CLOCK 3 DEFINE ADC_SAMPLEUS 50 number VAR word CMCON = 7 ' Comparators off ANSEL = %00000001 ' GPIO.0 A/D in, rest digital ADCON0.7 = 1 ' Right justify for 10-bit TRISIO = %00000001 ' GPIO.0 = input, rest outputs Pause 100 Loop: ADCIN 0, number ' (0-1023) IF (number > 0) AND (number < 400) Then GPIO 1=1 GPIO.2=0 GPIO.4=0 EndIF IF (number > 401) AND (number < 800) Then GPIO.1=0 GPIO.2=1 GPIO.4=0 EndIF IF (number > 801) AND (number < 1024) Then GPIO.1=0 GPIO.2=0 GPIO.4=1 EndIF number = 0 GoTo loop End
properly, this should work.
You can find several more 12F675 A/D examples here;
http://www.microengineeringlabs.com/...ples.htm#x4pbp




Bookmarks