Hi,
i try to read ADC0 to ADC3 channes which are triggered by Timer0.
When i trig just ADC0 by Timer0 i can read true value BUT when i trig ADC0 and ADC1 , i measure wrong value on ADCRESULT0 and additionaly although there is not any analog value on ADC1, iread some values on ADCRESULT1.
void SetupADCSoftware() { Uint16 acqps; acqps = 14; EALLOW; AdcaRegs.ADCSOC0CTL.bit.CHSEL = 0; //SOC0 will convert pin A0 AdcaRegs.ADCSOC0CTL.bit.ACQPS = acqps; //sample window is acqps + AdcaRegs.ADCSOC0CTL.bit.TRIGSEL = 1; AdcaRegs.ADCSOC1CTL.bit.CHSEL = 1; //SOC1 will convert pin A1 AdcaRegs.ADCSOC1CTL.bit.ACQPS = acqps; //sample window is acqps + //1 SYSCLK cycles AdcaRegs.ADCSOC1CTL.bit.TRIGSEL = 1; AdcaRegs.ADCSOC2CTL.bit.CHSEL = 2; //SOC2 will convert pin A2 AdcaRegs.ADCSOC2CTL.bit.ACQPS = acqps; //sample window is acqps + AdcaRegs.ADCSOC2CTL.bit.TRIGSEL = 1; AdcaRegs.ADCSOC3CTL.bit.CHSEL = 3; //SOC3 will convert pin A3 AdcaRegs.ADCSOC3CTL.bit.ACQPS = acqps; //sample window is acqps + AdcaRegs.ADCSOC3CTL.bit.TRIGSEL = 1; AdcaRegs.ADCINTSEL1N2.bit.INT1SEL = 0x3; //end of SOC3 will set INT1 flag AdcaRegs.ADCINTSEL1N2.bit.INT1E = 1; //enable INT1 flag AdcaRegs.ADCINTFLGCLR.bit.ADCINT1 = 1; //make sure INT1 flag is cleared EDIS; }
void ConfigureADC(void) { EALLOW; //write configurations AdcaRegs.ADCCTL2.bit.PRESCALE = 0; //set ADCCLK divider to /1 AdcSetMode(ADC_ADCA, ADC_RESOLUTION_12BIT, ADC_SIGNALMODE_SINGLE); //Set pulse positions to late AdcaRegs.ADCCTL1.bit.INTPULSEPOS = 1; //power up the ADCs AdcaRegs.ADCCTL1.bit.ADCPWDNZ = 1; DELAY_US(1000); EDIS; }
Can anyone has an idea about reason of this?