Code: Select all
AD1PCFGL = (0U);
AD2PCFGL = (0U);
AD1PCFGH = ((0U) & 65535);
/* S-Function "dsPIC_ADC" initialization Block: <Root>/ADC Input */
/* Initialise ADC converter */
/* 0 mean each 1 conversion */
#define NoSamplesADC 0
#define ADCSval 12
#define SAMCval (1 << 8)
#define OutFormatBitsval (0 << 8)
#define VoltRef (0 << 13)
/* Use internal counter Trigger, continuous simulatenous sampling */
AD1CON1 = 0x0004 | (7 << 5) | (0 << 10)| OutFormatBitsval;
AD1CON2 = 0x0400 | (NoSamplesADC << 2) | VoltRef;
AD1CSSL = (1 & 65535);
AD1CON3 = (ADCSval | SAMCval) & 0xff7f;
AD1CHS0 = 0x0000;
IPC2 = (IPC2 | (6 << 12)); /*Interrupt Priority : 6*/
_AD1IF = 0;
/* We set _ADIE = 1 in the main file if necessary*/
/* Clear Off Any Interrupt Due To Configuration */
/* Turn on ADC Module */
AD1CON1bits.ADON= 1;
I'm using the Explorer 16 board with the dsPIC33fJ256GP710 onboard and was trying to diagnose why most of my AN* pins were sitting at 3.7V (at least pins AN0-AN4, AN8-10) which is when I ran into this. I know that RB15 is at least one of the pins causing this increased voltage as it's connected to the LCD on the e16 board. But this isn't the real issue as none of this should be a problem if the pins are correctly configured.