Page 1 of 1

PIC18F2523 12 bit adc

Posted: Fri Jun 29, 2007 3:43 pm
by pheelius
Is there any way of accessing the full 12 bits of the PIC18F2523's ADC, it seems to be restricted to the usual 10bits of the majority of the PICs.

Posted: Fri Jun 29, 2007 5:14 pm
by Benj
Hello

I will look into this for you.

Posted: Fri Jun 29, 2007 5:29 pm
by Benj
Ok I think I have fixed the problem now

Open the FCD file for the 18F2523. and edit the following line.

Code: Select all

ADCFull="short iRetVal;\niRetVal = (adresh << 2);\niRetVal += (adresl >> 6);\nreturn (iRetVal);\n"
Change it to the following

Code: Select all

ADCFull="short iRetVal;\niRetVal = (adresh << 4);\niRetVal += (adresl >> 4);\nreturn (iRetVal);\n"
Then restart Flowcode and you should now have access to all 12 ADC bits.

Note: This fix will also work for the 18F2423, 18F4423 and 18F4523

Posted: Fri Jun 29, 2007 6:15 pm
by pheelius
i've just tried what you suggested but when I read the adc of a pic18f2523 as an integer and display it in on an lcd I still only get a 10 bit value.

Posted: Fri Jun 29, 2007 7:09 pm
by pheelius
Found what else you need to do, at the beginning of the fcd files you also need to change the line:

ADCBits=10

to

ADCBits=12


javascript:emoticon(':D')
Very Happy :D

Posted: Mon Jul 02, 2007 9:23 am
by Benj
Hello

Thanks for that. Is it running with the proper 12 bit accuracy now.