So I had to re-read through the ADC document and ask for some help, but I think I've found the way.
My previous iteration used a method of defining certain parameters, but I ended up just doing direct assignment to the registers eventually.
For anyone else with the same problem, the following is my code:
Configuration for analog:
DDPCONbits.JTAGEN = 0;
TRISB = 0x1111;
IFS1CLR = 2; //clear ADC conversion interrupt
IEC1SET = 2; //enable ADC interrupt
AD1PCFG = 0x0000; //Configure all input pins to Analog
AD1CON1 = 0b00000000000000001000000011100110; //Configure Sample clock source
AD1CON2 = 0b0000010000100000; //Configure ADC voltage reference
AD1CON3 = 0x0000; //Configure ADC conversion clock
AD1CON3bits.SAMC = 0b00001; //auto sample at 2TAD
AD1CON3bits.ADCS = 0b00000001; //TAD = 4TPB
AD1CHS = 0x00000000; //Configure input channels- CH0+ input,
AD1CON2bits.CSCNA=1;
AD1CSSL = 0b0001001111111100;
AD1CON1SET = 0x8000; //Turn on the ADC module
Then, for acquisition, I call this method within an ISR on a timer of ~half a second:
void getAnalog() {
while( ! IFS1bits.AD1IF); //wait until buffers contain new samples
AD1CON1bits.ASAM = 0; //stop automatic sampling (shut down ADC basically)
vt1 = ADC1BUF0*.003185;
vt2 = ADC1BUF1*.003185;
vt3 = ADC1BUF2*.003185;
vt4 = ADC1BUF3*.003185;
mosVolt = ADC1BUF4*.003185;
Battery_volt = ADC1BUF5*.003185;
vt5 = ADC1BUF6*.006125;
vt6 = ADC1BUF7*.006125;
Csensor_volt = ADC1BUF8*.006125;
IFS1bits.AD1IF = 0;
AD1CON1bits.ASAM = 1; //restart ADC and sampling
}
Variable names and scalers on each may vary.
DDPCONbits.JTAGEN = 0; TRISBbits.TRISB12 = 1; AD1PCFGbits.PCFG12 = 0;
\$\endgroup\$