Hello!
Hope you are all well.
In a code example, TI mentions that one can oversample an ADC input to get better resolution of that pin, such as:
AdcaRegs.ADCSOC5CTL.bit.CHSEL = 2; // SOC5 will convert ADCINA2
AdcaRegs.ADCSOC5CTL.bit.ACQPS = 19; // SOC5 will use sample duration of 20 SYSCLK cycles
AdcaRegs.ADCSOC5CTL.bit.TRIGSEL = 5; // SOC5 will begin conversion on ePWM1 SOCA
AdcaRegs.ADCSOC6CTL.bit.CHSEL = 2; // SOC6 will convert ADCINA2
AdcaRegs.ADCSOC6CTL.bit.ACQPS = 19; // SOC6 will use sample duration of 20 SYSCLK cycles
AdcaRegs.ADCSOC6CTL.bit.TRIGSEL = 5; // SOC6 will begin conversion on ePWM1 SOCA
AdcaRegs.ADCSOC7CTL.bit.CHSEL = 2; // SOC7 will convert ADCINA2
AdcaRegs.ADCSOC7CTL.bit.ACQPS = 19; // SOC7 will use sample duration of 20 SYSCLK cycles
AdcaRegs.ADCSOC7CTL.bit.TRIGSEL = 5; // SOC7 will begin conversion on ePWM1 SOCA
AdcaRegs.ADCSOC8CTL.bit.CHSEL = 2; // SOC8 will convert ADCINA2
AdcaRegs.ADCSOC8CTL.bit.ACQPS = 19; // SOC8 will use sample duration of 20 SYSCLK cycles
AdcaRegs.ADCSOC8CTL.bit.TRIGSEL = 5; // SOC8 will begin conversion on ePWM1 SOCA
But, what do we do with these results contained in the registers when we need to measure the data and perform control algorithms?
If I need to oversample an output voltage, since it needs to be very accurate, I can call:
volts = AdcbResultRegs.ADCRESULT8; // Read value in ADC reg from SOC8 conversion
But this defeats the purpose of an oversample, since we are just reading a single result in the register. Do we need to average out the sampled results,
and if so, is there an equation that I can implement to do this? I would assume it may be slightly more complicated than a simple average of the four sensor measurements.
Regards,
Joel