I'm trying to read in a value using a few analog pins on a PIC32 (MX775F512H), including RB12– part of the JTAG pins on the device. The device the board is reading from works great, but the board itself can't read the pin in.
I'm able to set the pin high using this code:
DDPCONbits.JTAGEN = 0;
TRISBbits.TRISB12 = 1;
AD1PCFGbits.PCFG12 = 0;
I'm intending there to disable JTAG and then write all the pins to high. RB0 through RB7 work as expected, but RB8 through RB15 float at a few millivolts.
How can I get my expected functionality out of these pins? Any searching on here and on Google hasn't led to much, and the documentation isn't clear on what to do other than to disable JTAG.
Best Answer
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:
Then, for acquisition, I call this method within an ISR on a timer of ~half a second:
Variable names and scalers on each may vary.