Other Parts Discussed in Thread: SYSCONFIG
Tool/software:
Hello,
I am trying to read ADC values using the 28379D control card. The input current is transmitted to the ADC pin through a sensor, and I have configured the code to read the values accordingly.
In the debugging window, ADCBRESULT5 and ADCBRESULT4 are fixed at around 15xx (when no current is applied). However, sometimes the calculated value of ADCBRESULT5 - ADCBRESULT4 spikes to 65000, causing instability in the controller that relies on the current measurement.

The attached screenshot was taken from the debugging window while the controller was turned off. It shows ADCRESULT5, ADCRESULT4, and the difference between the two values.
Below is the ADC setup.
I am using ADCA1 to ADCA5 and ADCB1 to ADCB5, with the current issue occurring on ADCB5 and ADCB4.
void setupADCSOC(void)
{
EALLOW;
//ADCA
AdcaRegs.ADCSOC0CTL.bit.CHSEL = 0; // SOC0(=ADCA0)
AdcaRegs.ADCSOC0CTL.bit.ACQPS = 9; // Sample window is 10 SYSCLK cycles
AdcaRegs.ADCSOC0CTL.bit.TRIGSEL = 1; // Trigger on CPUTIMER0
AdcaRegs.ADCSOC1CTL.bit.CHSEL = 1; // SOC1(=ADCA1)
AdcaRegs.ADCSOC1CTL.bit.ACQPS = 9; // Sample window is 10 SYSCLK cycles
AdcaRegs.ADCSOC1CTL.bit.TRIGSEL = 1; // Trigger on CPUTIMER0
//
AdcaRegs.ADCSOC2CTL.bit.CHSEL = 2; // SOC2(=ADCA2)
AdcaRegs.ADCSOC2CTL.bit.ACQPS = 9; // Sample window is 10 SYSCLK cycles
AdcaRegs.ADCSOC2CTL.bit.TRIGSEL = 1; // Trigger on CPUTIMER0
AdcaRegs.ADCSOC3CTL.bit.CHSEL = 3; // SOC3(=ADCA3)
AdcaRegs.ADCSOC3CTL.bit.ACQPS = 9; // Sample window is 10 SYSCLK cycles
AdcaRegs.ADCSOC3CTL.bit.TRIGSEL = 1; // Trigger on CPUTIMER0
AdcaRegs.ADCSOC4CTL.bit.CHSEL = 4; // SOC4(=ADCA4)
AdcaRegs.ADCSOC4CTL.bit.ACQPS = 9; // Sample window is 10 SYSCLK cycles
AdcaRegs.ADCSOC4CTL.bit.TRIGSEL = 1; // Trigger on CPUTIMER0
AdcaRegs.ADCSOC5CTL.bit.CHSEL = 5; // SOC5(=ADCA5)
AdcaRegs.ADCSOC5CTL.bit.ACQPS = 9; // Sample window is 10 SYSCLK cycles
AdcaRegs.ADCSOC5CTL.bit.TRIGSEL = 1; // Trigger on CPUTIMER0
AdcaRegs.ADCINTSEL1N2.bit.INT1SEL = 5; // End of SOC5 will set INT1 flag
AdcaRegs.ADCINTSEL1N2.bit.INT1E = 1; // Enable INT1 flag
AdcaRegs.ADCINTFLGCLR.bit.ADCINT1 = 1; // Make sure INT1 flag is cleared
//ADCB
AdcbRegs.ADCSOC0CTL.bit.CHSEL = 0; // SOC0(=ADCB0)
AdcbRegs.ADCSOC0CTL.bit.ACQPS = 9; // Sample window is 10 SYSCLK cycles
AdcbRegs.ADCSOC0CTL.bit.TRIGSEL = 1; // Trigger on CPUTIMER0
AdcbRegs.ADCSOC1CTL.bit.CHSEL = 1; // SOC1(=ADCB1)
AdcbRegs.ADCSOC1CTL.bit.ACQPS = 9; // Sample window is 10 SYSCLK cycles
AdcbRegs.ADCSOC1CTL.bit.TRIGSEL = 1; // Trigger on CPUTIMER0
AdcbRegs.ADCSOC2CTL.bit.CHSEL = 2; // SOC2(=ADCB2)
AdcbRegs.ADCSOC2CTL.bit.ACQPS = 9; // Sample window is 10 SYSCLK cycles
AdcbRegs.ADCSOC2CTL.bit.TRIGSEL = 1; // Trigger on CPUTIMER0
AdcbRegs.ADCSOC3CTL.bit.CHSEL = 3; // SOC3(=ADCB3)
AdcbRegs.ADCSOC3CTL.bit.ACQPS = 9; // Sample window is 10 SYSCLK cycles
AdcbRegs.ADCSOC3CTL.bit.TRIGSEL = 1; // Trigger on CPUTIMER0
AdcbRegs.ADCSOC4CTL.bit.CHSEL = 4; // SOC4(=ADCB4)
AdcbRegs.ADCSOC4CTL.bit.ACQPS = 9; // Sample window is 10 SYSCLK cycles
AdcbRegs.ADCSOC4CTL.bit.TRIGSEL = 1; // Trigger on CPUTIMER0
AdcbRegs.ADCSOC5CTL.bit.CHSEL = 5; // SOC5(=ADCB5)
AdcbRegs.ADCSOC5CTL.bit.ACQPS = 9; // Sample window is 10 SYSCLK cycles
AdcbRegs.ADCSOC5CTL.bit.TRIGSEL = 1; // Trigger on CPUTIMER0
//AdcbRegs.ADCINTSEL1N2.bit.INT1SEL = 0; // End of SOC5 will set INT1 flag
// AdcbRegs.ADCINTSEL1N2.bit.INT1E = 1; // Enable INT1 flag
//AdcbRegs.ADCINTFLGCLR.bit.ADCINT1 = 1; // Make sure INT1 flag is cleared
EDIS;
}