Steve, Code looks fine to me, except one point - Why do you have an XOR on the registers ? e.g. on TRISIO ? Just looking at some of my code and MicroChip code which initialises these registers, neither of which use an XOR. I thought this was the function of changing to Bank1 using the STATUS,RP0 flag ? I'm still new to this PIC Assembler so I may be wrong on this, but that's the only thing that stood out to me as being different to the code I've seen and written, which works fine. Andy stesquib@MINES.EDU wrote: > Hello, The following ADC code for a 12F675 constantly returns zero (puts 0 in > ADRESH). > > ;******** Initialization ************ > clrf GPIO > clrf INTCON > > bsf STATUS,RP0 > movlw 0x0FC > movwf TRISIO ^ 0x080 ;GPIO 0,1 are outputs > movlw 0x080 > movwf OPTION_REG ^ 0x080 ;pullups off > movlw 0x05 ;Fosc/16, AN3 (GPIO4) is analog input > movwf ANSEL ^ 0x080 > clrf PIE1 ^ 0x080 > bcf STATUS,RP0 > > clrf N > ;****** END Initialization ********** > > > ;************* Main ***************** > main > movlw 0x00C ;left justified, channel 3 (gpio 4) > movwf ADCON0 ;Vref = Vdd > > movlw 7 ;wait for adc to charge > addlw 0x0ff > btfss STATUS,Z > goto $ - 2 > > bsf ADCON0,GO ;start ADC > btfsc ADCON0,GO ;allow ADC to finish > goto $ - 1 > > movf ADRESH,w > movwf N ;place 8 upper bits in N > > call Serout ;output N > > call onesec > goto main > ;*********** End Main *************** > > If anyout could clear this up for me I'de be gateful. > Thx, Steve > > -- > http://www.piclist.com hint: The list server can filter out subtopics > (like ads or off topics) for you. See http://www.piclist.com/#topics -- Andy Pryer Email: andy.pryer@cubecomputing.com Web: http://www.cubecomputing.com Tel/Fax: 01582 703872 ------------------------------------------------------------------ PGP Fingerprint FF1A 67E9 8E52 8689 68DF C86A FCE9 002B 61B8 5C73 -- http://www.piclist.com hint: The list server can filter out subtopics (like ads or off topics) for you. See http://www.piclist.com/#topics