I don't know why ADC doesn't work. The ADCRESULT0 - ADCRESULT15 doesn't change even though my input to the ADC is a sine wave...
Please see my code below to see whether there is anything wrong?
void vMeasInit(VMEAS *p)
{
DELAY_US(ADC_usDELAY);
AdcRegs.ADCTRL1.all = ADC_RESET_FLAG; // Reset the ADC Module, 0x4000
asm(" NOP ");
asm(" NOP ");
AdcRegs.ADCTRL3.bit.ADCBGRFDN = 0x3; // Power up bandgap/reference circuitry
DELAY_US(ADC_usDELAY); // Delay before powering up rest of ADC
AdcRegs.ADCTRL3.bit.ADCPWDN = 1; // Power up rest of ADC
AdcRegs.ADCTRL3.bit.ADCCLKPS = 3; // Set up ADCTRL3 register
DELAY_US(ADC_usDELAY);
AdcRegs.ADCTRL1.all = ADCTRL1_INIT_STATE_BIPOLAR; // Set up ADCTRL1 register
AdcRegs.ADCTRL2.all |= ADCTRL2_INIT_STATE; // Set up ADCTRL2 register
AdcRegs.ADCMAXCONV.all = 0x0003;
AdcRegs.ADCCHSELSEQ1.all = 0x4376;
AdcRegs.ADCCHSELSEQ2.all = 0x5210;
AdcRegs.ADCCHSELSEQ3.all = 0xBA98;
AdcRegs.ADCCHSELSEQ4.all = 0xFEDC;
EvaRegs.GPTCONA.bit.T1TOADC = 1; // Set up EV Trigger with Timer1 UF
//ADCcalibrationDriverInit(calibrate);
}
Thanks a lot!