PIC24 5V devices with 12-BIT ADC resolution [SOLVED]

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 6.

Moderator: Benj

Post Reply
RTJNair
Posts: 12
Joined: Sun Nov 09, 2014 5:53 pm
Location: Oman/India
Has thanked: 5 times
Been thanked: 2 times
Contact:

PIC24 5V devices with 12-BIT ADC resolution [SOLVED]

Post by RTJNair »

Hi all,

Noticed that the ADC resolution for PIC24FV32KA301 (5V, 12BIT ADC) is reading only 10bits (1023) instead of 12bits (4095). Tried the available two option for VREF ie; VDD as well as V+Ref tied to VDD but both didn't yield expected results. Maybe some thing has to be modified in the 16BIT ADC CAL file to include this class of PIC24 MCUs.

Can anyone help me with a solution to achieve the 12BIT resolution ?.

Thanks in advance.

RTJ Nair
Last edited by RTJNair on Thu Jun 15, 2017 10:25 am, edited 1 time in total.

User avatar
LeighM
Matrix Staff
Posts: 2178
Joined: Tue Jan 17, 2012 10:07 am
Has thanked: 481 times
Been thanked: 699 times
Contact:

Re: PIC24 5V devices with 12-BIT ADC resolution

Post by LeighM »

Hi,
Until we make a more long term implementation of this feature, there is a workaround that you could try.
Please add a C icon to your project, at the start, with the following content:

Code: Select all

AD1CON1bits.MODE12 = 1;
That will enable the 12 bit mode of the ADC.

RTJNair
Posts: 12
Joined: Sun Nov 09, 2014 5:53 pm
Location: Oman/India
Has thanked: 5 times
Been thanked: 2 times
Contact:

Re: PIC24 5V devices with 12-BIT ADC resolution

Post by RTJNair »

Thanks LeighM.

Tried but the compiler gives an error and didn't switch to 12BITs,

TESTPIC24working.c:3147: error: 'AD1CON1BITS' has no member named 'MODE12'

I checked the datasheet and it doesn't mention "MODE12" bits for PIC24FV32KA301.

RTJ Nair

User avatar
LeighM
Matrix Staff
Posts: 2178
Joined: Tue Jan 17, 2012 10:07 am
Has thanked: 481 times
Been thanked: 699 times
Contact:

Re: PIC24 5V devices with 12-BIT ADC resolution

Post by LeighM »

Hi,
Sorry, I've given you Flowcode V7 code, I'll investigate what you need for V6

User avatar
LeighM
Matrix Staff
Posts: 2178
Joined: Tue Jan 17, 2012 10:07 am
Has thanked: 481 times
Been thanked: 699 times
Contact:

Re: PIC24 5V devices with 12-BIT ADC resolution

Post by LeighM »

Try this ...

Code: Select all

set_bit(AD1CON1, 10);

RTJNair
Posts: 12
Joined: Sun Nov 09, 2014 5:53 pm
Location: Oman/India
Has thanked: 5 times
Been thanked: 2 times
Contact:

Re: PIC24 5V devices with 12-BIT ADC resolution

Post by RTJNair »

Perfect. Many thanks LeighM.

Now I could get the 12bit resolution.

Appreciate the quick solution.

RTJ Nair

Post Reply