strong-storm2006
New Member
i try to use pic18f452 as analog to digital i programme it and i get successful programming by IC- prog but when i t try
to convert analog to digital i do not get any thing in the PORTC i use RC oscillator
and pin#2(AN0) is analog input and Vref+,Vref- are the same Vdd&Vss...
this is the code:
List p=18f452,f=inhx32
#include <p18f452.inc>
org 0x0000
clrf PORTC
movlw 0x00
movwf TRISC
movlw B'11000000'
movwf ADCON1
movlw B'11000001'
movwf ADCON0
again:
bsf ADCON0, GO
Wait:
btfsc ADCON0,GO ;Wait for conversion to complete
goto Wait
movf ADRESH,W ;Write A/D result to PORTC
movwf PORTC ;LEDs
goto again
end
why i do not get the result of converting analog to digital in the portC
and how we can get it... is the problem from code or circuit
to convert analog to digital i do not get any thing in the PORTC i use RC oscillator
and pin#2(AN0) is analog input and Vref+,Vref- are the same Vdd&Vss...
this is the code:
List p=18f452,f=inhx32
#include <p18f452.inc>
org 0x0000
clrf PORTC
movlw 0x00
movwf TRISC
movlw B'11000000'
movwf ADCON1
movlw B'11000001'
movwf ADCON0
again:
bsf ADCON0, GO
Wait:
btfsc ADCON0,GO ;Wait for conversion to complete
goto Wait
movf ADRESH,W ;Write A/D result to PORTC
movwf PORTC ;LEDs
goto again
end
why i do not get the result of converting analog to digital in the portC
and how we can get it... is the problem from code or circuit