Hi Filip,

That is strange. There is a sample program for the 18f2580 (not 18f2580) that 
does both high resolution and low resolution. The sample file is 
18f2520_adc_depedent.jal.

As far as I can remember I tested this sample file when I made a modification 
to the ADC libraries (remove JANSEL).

I think this setting is no longer used: const bit ADC_HIGH_RESOLUTION = ON

If I look at the datasheets both ADC's look the same. I am not sure if I have a 
18F2580 to test it, will check later but it should work.

Kind regards,

Rob

________________________________
Van: [email protected] <[email protected]> namens flyway38 
<[email protected]>
Verzonden: dinsdag 30 augustus 2022 18:58
Aan: jallib <[email protected]>
Onderwerp: [jallib] PIC18F2580 ADC can't convert High Resolution

Hello,

Cannot make my PIC18F2580 make ADC conversions at 10bits (High Resolution).
It is converting at 8bit (Low Resolution).
Here's my code.
Any help would be great.

-- Measure using high resolution
const bit ADC_HIGH_RESOLUTION = ON
-- Step 1: ADC analog input pin setup
const byte ADC_CHANNEL = 0                       -- port 0 is analog input 
(default)
const byte ANSEL_ANS0 = TRUE                     -- potmeter connected to 
pin_AN0
pin_AN0_direction = input
-- Step 2: Set VDD and VSS as Vref
const byte ADCON0_VCFG = FALSE
-- Step 3: Use Frc as ADC clock
const byte ANSEL_ADCS = 0b011
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()
--
var byte AdcChnn = 0

Inside Forever Loop

AdcData = adc_read_high_res(AdcChnn)

Using latest (I think) compiler;
jal jalv25r6 (compiled Oct 29 2021)

Thankyou.

Kind regards,
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]<mailto:[email protected]>.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jallib/beb04e53-0d62-43bc-95dc-9680c4ef175an%40googlegroups.com<https://groups.google.com/d/msgid/jallib/beb04e53-0d62-43bc-95dc-9680c4ef175an%40googlegroups.com?utm_medium=email&utm_source=footer>.

-- 
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/GVXP195MB1637DAF544E323B8DBB09B60E6789%40GVXP195MB1637.EURP195.PROD.OUTLOOK.COM.

Reply via email to