Dear team:
while( index < SampleSize ){ //Wait for ADCINT1 to trigger, then add ADCRESULT0-7 registers to sum while (AdcRegs.ADCINTFLG.bit.ADCINT1 == 0){} AdcRegs.ADCINTFLGCLR.bit.ADCINT1 = 1; //Must clear ADCINT1 flag since INT1CONT = 0 Sum += AdcResult.ADCRESULT0; Sum += AdcResult.ADCRESULT1; Sum += AdcResult.ADCRESULT2; Sum += AdcResult.ADCRESULT3; Sum += AdcResult.ADCRESULT4; Sum += AdcResult.ADCRESULT5; Sum += AdcResult.ADCRESULT6; // Wait for SOC9 conversion to start, which gives time for SOC7 conversion result while( AdcRegs.ADCSOCFLG1.bit.SOC9 == 1 ){} Sum += AdcResult.ADCRESULT7; //Wait for ADCINT2 to trigger, then add ADCRESULT8-15 registers to sum while (AdcRegs.ADCINTFLG.bit.ADCINT2 == 0){} AdcRegs.ADCINTFLGCLR.bit.ADCINT2 = 1; //Must clear ADCINT2 flag since INT2CONT = 0 Sum += AdcResult.ADCRESULT8; Sum += AdcResult.ADCRESULT9; Sum += AdcResult.ADCRESULT10; Sum += AdcResult.ADCRESULT11; Sum += AdcResult.ADCRESULT12; Sum += AdcResult.ADCRESULT13; Sum += AdcResult.ADCRESULT14; // Wait for SOC1 conversion to start, which gives time for SOC15 conversion result while( AdcRegs.ADCSOCFLG1.bit.SOC1 == 1 ){} Sum += AdcResult.ADCRESULT15; index+=16; } // end data collection
The above code is the part of ADCLO oversampling,
// Setup ADCINT1 and ADCINT2 trigger source
AdcRegs.INTSEL1N2.bit.INT1SEL = 6; //EOC6 triggers ADCINT1
AdcRegs.INTSEL1N2.bit.INT2SEL = 14; //EOC14 triggers ADCINT2
The customer's understanding is that the ADCINT1 interrupt is triggered after the sampling of channel 6 ends, which triggers the sampling of channels 8-15.
At this time, channels 7 and 8 are sampled at the same time, 7 is processed by the SHA sample-and-hold circuit, and 8 is processed by the SHB sample-and-hold circuit. Therefore, the sample value of 7 can be read only when 9 starts sampling. Similar to: “// Wait for SOC1 conversion to start, which gives time for SOC15 conversion result”.
1, Is this to make the connection between SHA and SHB closer?
2, If it is changed to trigger ADCINT1 at the end of the sampling of channel 7 and trigger ADCINT2 at the end of the sampling of channel 15, can the calibration acquisition be completed?
Best regards