Hello,
When I was programming my ADC previously I was directed to use oversampling techniques to improve the resolution of my ADC. Here is how I was told to do it on the C2000 F2837xD device:
// Main computational interrupt triggered from ADC INT1 (PIE)
// This ISR operates at a frequency of 1MHz, since it is triggered by ADCA INT1,
// Which is set by an end-of-conversion of SOC8 on EPWM1, itself operating at 1MHz
interrupt void MainCPU_ISR(void)
{
// Read sensor data across the ADCs
// Read all in CPU1 to make easier to distribute between cores
inputVolts_CLA1 = (float) AdcbResultRegs.ADCRESULT5; // Read the ADC value placed into ADC register
inputVolts_CPU2 = inputVolts_CLA1; // Place a copy into CLA shared RAM in form
// Oversample the results 8 times for voltage and average, 4 times and average for currents
flyVolts = (((float) AdcaResultRegs.ADCRESULT1
+ (float) AdcaResultRegs.ADCRESULT2
+ (float) AdcaResultRegs.ADCRESULT3
+ (float) AdcaResultRegs.ADCRESULT4
+ (float) AdcaResultRegs.ADCRESULT5
+ (float) AdcaResultRegs.ADCRESULT6
+ (float) AdcaResultRegs.ADCRESULT7
+ (float) AdcaResultRegs.ADCRESULT8)/8); // Compute the average reading on the over-sampled Cathode Output Voltage SOCs
// 8x over-sampling for cathode voltage
flyCurr = (((float) AdccResultRegs.ADCRESULT5
+ (float) AdccResultRegs.ADCRESULT6
+ (float) AdccResultRegs.ADCRESULT7
+ (float) AdccResultRegs.ADCRESULT8)/4); // Compute the average reading on the over-sampled Fly-back current SOCs
// 4x over-sampling for cathode current
// Return from interrupt
AdcaRegs.ADCINTFLGCLR.bit.ADCINT1 = 1; // Clear ADC INT1 flag
PieCtrlRegs.PIEACK.all = PIEACK_GROUP1; // Acknowledge PIE group 1 to enable further interrupts
}
Would it not be easier to do this not as float values? I get an error about needing to relax the floating point arithmetic to allow division. Maybe this is not as efficient? Here's an example of something similar I found by SIlicon Labs:
https://www.cypress.com/file/236481/download
Is there a similar way we can perform this in the c2000 series? From the above attached document, there are also multiple other ways SI suggests to increase resolution of the ADC measurements, are any of these possible on the c2000 series of MCU's?
As a final question, is oversampling and averaging like the above example possible for differential, 16-bit ADC measurements? How does it differ, and how would it be best to implement this in code?
Best regards,
Joel