Hello all,
New question.
My PIC is reading ok ADC values if below 2.5V (1/2 of range VCC/GND).
It seems like 11bit ADC behaviour.
My code:
-- ok, now let's configure ADC
-- Step 1: ADC analog input pin setup
const byte ADC_CHANNEL = 0 -- port 0 is analog input
(default)
pin_AN0_direction = input
const byte ANSEL_ANS0 = TRUE -- potmeter connected to
pin_AN0
-- Step 2: Set VDD and VSS as Vref
const byte ADCON0_VCFG = FALSE
-- Step 3: Use Frc as ADC clock
const byte ANSEL_ADCS = 0b110
--
const ADC_RSOURCE = 500 -- Input Resistance
const ADC_TEMP = 20 -- PIC Temperature
-- We want the fastest possible ADC timing, so we specify here the
--const ADC_MIN_TAD = 1
const ADC_MAX_TAD = 10
-- Now we can include the library
include adc
-- And initialize the whole with our parameters
adc_init()
Inside Forever Loop:
iVal = 0 -- Its a DWord
--
for AdcReadings loop
AdcData = adc_read_high_res(AdcChnn)
iVal = iVal + dword(AdcData)
end loop
--
mVal = word(iVal / dword(AdcReadings))
Any help would be great.
Thank you very much.
Kind regrads,
Filipe Santos
--
You received this message because you are subscribed to the Google Groups
"jallib" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/jallib/5c020fb1-f8fa-4684-9284-1dc3a1793ca4n%40googlegroups.com.