In the PIC32MZ EF device are a lot of AD converter. The bad thing is if I read AN0,AN1,AN2 I have on all the tree converter just the signal from AN0
I had a look in the PIC32BIT_CAL_ADC.c and for me looks like there is a wrong line.
iRetVal = ADCDATA0;// but the PIC32MZ EF has ADCDATA0 to ADCDATA44 for the AD result
Is this the problem ? Or is there a command to set the all the result to ADCDATA0 ?
Code: Select all
MX_UINT16 FC_CAL_ADC_Sample (MX_UINT8 Sample_Mode)
{
MX_UINT16 iRetVal;
/* Wait the conversions to complete */
while (ADCDSTAT1bits.ARDY0 == 0);
/* fetch the result */
iRetVal = ADCDATA0;
/* fetch the result */
if (Sample_Mode)
{
iRetVal = ADCDATA0;
}
else
iRetVal = ADCDATA0 >> 4; //8-bit ADC
delay_us(1); //Required or processor locks up using Raw functions
return (iRetVal);
}