Quote Originally Posted by kvrajasekar View Post
... did the followin,tell me is it correct?

movlw b'00000000' ; select PORTA,0
movwf ADCON0
movlw b'00000001' ;switch on ADC
movwf ADCON0
here btfss ADCON0,2 ;checking whether conversion is in process or not
goto here
movf ADRES,0
movwf volt_val
Well, since it's a PicBasic forum, first I'll say that all you need to do is
Code:
ADCIN  0, volt_val
Or the ASM version...
Code:
    movlw b'10000001' ;FOSC32, AN0, ADC ON
    movwf ADCON0
    movlw   0x07      ; 21us @ 4mhz
    movwf   Delay    
DLY1 decfsz  Delay,1  ; acquisition time
    goto DLY1    
    bsf   ADCON0, 2   ; Start an A/D conversion
here btfss ADCON0,2   ;checking whether conversion is in process or not
    goto here
    movf ADRES,0
    movwf volt_val
Note: The volt_val and Delay variables must be in BANK0 to work.