Dear Team,
I am measuring filtered average dc voltages (float values) giving to ADC. I am sending 4 voltages to 4 ADCs (A0,B0,A1,B1). When I start all values should be same and I am getting the same. But when I started changing one particular voltage, corresponding adc count should change but along with it the pin beside that adc pin also getting changes slowly. I don't know why other ADC reading getting effected with variation in one adc pin input.
Suppose if I am varying A0 input, A1 is drifting slowly same way B0 and B1. but not between A0 and B0 or A1 and B1. Can you please let me know what could be the reason for it. I attached a part of code which is related to ADC, please let me know if any issues with it.
Thanks,
void main(void)
{
............
AdcRegs.ADCTRL1.all = 0;
AdcRegs.ADCTRL1.bit.ACQ_PS = 0x7; // S/H width in ADC module periods = 8 ADC clocks
AdcRegs.ADCTRL1.bit.CONT_RUN = 1; // Setup continuous run
AdcRegs.ADCTRL1.bit.SEQ_CASC = 0x1; // Cascaded mode
AdcRegs.ADCTRL3.bit.ADCCLKPS = 0x1; // ADCCLK(FCLK)=HSPCLK/(2*ADCCLKPS)=25.0MHz/(1*2)=12.5MHz for ADCCLKPS = 1
AdcRegs.ADCTRL3.bit.SMODE_SEL = 0x1; //Sampling mode Simultaneous
AdcRegs.ADCCHSELSEQ1.bit.CONV00 = 0x0; //A0 and B0
AdcRegs.ADCCHSELSEQ1.bit.CONV01 = 0x1; //A1 and B1
AdcRegs.ADCMAXCONV.all = 0x0001; // For 4 ADC Inputs
.................
for(;;)
{
asm(" NOP");
}
}
interrupt void cpu_timer0_isr(void)
{
......................
AdcRegs.ADCTRL2.all = 0x2000;
while (AdcRegs.ADCST.bit.INT_SEQ1== 0) {}
AdcRegs.ADCST.bit.INT_SEQ1_CLR = 1;
temp = AdcRegs.ADCRESULT0 >>4 ;
v1 = temp;
temp = AdcRegs.ADCRESULT1 >>4 ;
v2 = temp;
temp = AdcRegs.ADCRESULT2 >>4;
v3 = temp;
temp = AdcRegs.ADCRESULT3 >>4;
v4 = temp;
....................................
}