ADC - error during compile.

Moderator: Benj

Post Reply
medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

ADC - error during compile.

Post by medelec35 »

Devices affected are:
18F2220, 18F2221, 18F2320, 18F2321, 18F24J10, 18F2410, 18F2420, 18F2423, 18F2450,
18F2455, 18F2480, 18F25J10, 18F2510, 18F2515, 18F2520, 18F2523, 18F2525, 18F2550,
18F2580, 18F2585, 18F2610, 18F2620, 18F2680, 18F4220, 18F4221, 18F4320, 18F4321,
18F44J10, 18F4410, 18F4420, 18F4423, 18F4450, 18F4455, 18F4480, 18F45J10, 18F4510,
18F4515, 18F4520, 18F4523, 18F4525, 18F4550, 18F4580, 18F4585, 18F4610, 18F4620,
18F4680, 18F4682 & 18F4685.

Jonny was the first to post about this:
http://www.matrixmultimedia.com/mmforum ... 452#p31445

Unfortunately I did not see that post when I posted my fix here:
http://www.matrixmultimedia.com/mmforum ... 077#p31579
Fix still worked OK, but not sure if 12 Bit ADC devices will work?
Martin

User avatar
STibor
Posts: 263
Joined: Fri Dec 16, 2011 3:20 pm
Has thanked: 116 times
Been thanked: 113 times
Contact:

Re: ADC - error during compile.

Post by STibor »

Pic18f6622 external ADC Vref setting does not work.

I checked the Flowcode4 PIC_ADC_12.c file included in the following line:

Code: Select all

/ / assign VREF Functionality
 # if (MX_ADC_VREF_OPT! = 0)
 st_bit (adcon1, VCFG0);
 # endif
Flowcode5 PIC_CAL_ADC.c line in the following file:
// ADC Type 12 Supported Devices
Now...

Code: Select all

 if (Vref! = 0) / / assign VREF Functionality
 st_bit (adcon0, VCFG0);
Change to...

Code: Select all

 Rewriting: if (Vref! = 0) / / assign VREF Functionality
 st_bit (adcon1, VCFG0);

Simulator works, not tested circuit.
Attachments
PIC_CAL_ADC.c
(85.83 KiB) Downloaded 343 times

User avatar
Enamul
Posts: 1772
Joined: Mon Mar 05, 2012 11:34 pm
Location: Nottingham, UK
Has thanked: 271 times
Been thanked: 814 times
Contact:

Re: ADC - error during compile.

Post by Enamul »

Hi,
Yes. You are right as datasheet says the same..This snapshot from ADCON1 register not from ADCON0.
ADC_Vref.png
(8.73 KiB) Downloaded 2371 times
Thanks for letting us know.
Enamul
University of Nottingham
enamul4mm@gmail.com

Post Reply