I change a bit of the program , but i am still getting 8 bit results ( max 255)
Code:
Define ADC_BITS 10 ' Set number of bits in result
Define ADC_CLOCK 3 ' Set clock source (3=rc)
Define ADC_SAMPLEUS 50 ' Set sampling time in uSec
ADCON0 = %00000001 ' AN0, Configure and turn on A/D Module
ADCON1 = %00001001 ' Analog input
ADCON2.7 =1 ' Right justified results for 10 bits,Fosc/8
Check_voltage_Low:
ADCON0 = 00010001 'Start Conversion
ADCON2.7 =1
ADCIN 4, voltage_check 'analog pin 4 get the 10 bit result Check the battery voltage on pin PORTA.5
lcdout $FE,1, "Battery voltage"
lcdout $FE,$C0, "TempC: ", dec voltage_check
pause 1500
Return
Bookmarks