There is a post by Darrel re this but I can't find it. I don't have any PICBasic code to hand but this in Proton might help -
Code:
ADCON1 = %00100000 ' ADCS=010 Fosc/32 4usec
Symbol Go_Done = ADCON0.1
Symbol ADON = ADCON0.0
Symbol VP6EN = VRCON.4 ' 0.6V Reference Enable Bit
Dim Ad_Result As ADRESL.Word ' Convert the ADRESL register into a WORD variable
Dim VDD As Word
VP6EN = 1 ' Turn 0.6V reference ON
ADCON0 = %10110101 ' right justify, Vdd, select 0.6v ref, ADC on
DelayUS 100 ' Wait for sample/hold capacitors to charge and VP6 to settle
Go_Done = 1 ' Start conversion
While Go_Done = 1 : Wend ' Poll the GO_DONE flag for completion of conversion
ADCON0 = %10110100 ' right justify, Vdd, Select 0.6v ref, ADC off
VP6EN = 0 ' Turn 0.6V reference OFF
VDD = 6144/Ad_Result ' convert input reading to VDD voltage *VDD must be a Word
' 0.6 * 1024 = 614.4 - 6144 To get 1/10th
George
Bookmarks