Newbie level 3
It's been awhile since I've attempted any assembly programming, and I always remember having lots of trouble debugging. Anyways I'm to get back into it, I'm trying to read voltage values from a photo-resistor. Everything seems to work fine except the only values that are returned are 0x01 and 0x61. I can't figure out what might be causing the problem everything seems to be exactly how it should be.
; LIST R=DEC LIST P=16f684 INCLUDE p16f684.inc INCLUDE macros.inc __CONFIG _FCMEN_OFF & _IESO_OFF & _BOD_OFF & _CPD_OFF & _CP_OFF & _MCLRE_ON & _PWRTE_ON & _WDT_OFF & _INTOSCIO PAGE org 0 ;Configure EEPROM bcf STATUS, 5 bcf INTCON, GIE ; disable interrupts bank1 clrf EEADR clrf EEDAT ;Configure ADC movlw 7 movwf CMCON0 ; turn off comparator bsf TRISA, 0 ; set RA0 to input bsf ANSEL, 0 ; set ANS0 to analog input movlw 01010000b movwf ADCON1 ; clock set to Fosc/16 bcf STATUS, 5 movlw 00000001b ;configure ADCON0 movwf ADCON0 ;Start process ;wait 8uS, maximum required aquisition time ;In this example I'm gonna use it to do any ; eeprom maintennance. In this case write eedat to eeprom pauc 1 main: bcf STATUS, 5 bsf ADCON0, GO ; begin conversion btfsc ADCON0, GO goto $-1 ; wait for completion movf ADRESH, 1 bank1 movwf EEDAT bsf STATUS, 5 bsf EECON1, WREN movlw 0x55 movwf EECON2 movlw 0xAA movwf EECON2 bsf EECON1, WR ; write begins btfsc EECON1, WR goto $-1 ;wait for write to end nop nop incf EEADR, 1 bcf STATUS, 5 bcf PIR1, EEIF ;back to ADC stuff tenth 8 goto main end