| ??? 08/22/08 14:36 Read: times Msg Score: +1 +1 Informative |
#157665 - Integrate decimate... |
This is a code snippet from the Silabs example for ADC_MuX. Idea is to acquire "n" ADC channels, then Integrte-Decimate each one of them over 256 samples and then post the final value as result. ( In this case the Int-Dec is loaded with 256 and hence after adding 256 samples to the Accum, it is right shifted 8 times and the result posted. )
Not sure what it does to the acquired samples and what is the purpose of this process??
void ADC0_ISR (void) interrupt 15
{
static unsigned int_dec=INT_DEC; // Integrate/decimate counter
// we post a new result when
// int_dec = 0
static long accumulator[ANALOG_INPUTS] ={0L};
// Here's where we integrate the
// ADC samples from input AIN0.0
unsigned char i;
AD0INT = 0; //clear ADC conversion complete overflow
accumulator[amux_convert] += ADC0; // Read ADC value and add to running
// total
if(amux_convert == (ANALOG_INPUTS-1)) // reset input index if the last input
//was just read
{
int_dec--; // Update decimation counter
// when last of the analog inputs
// sampled
}
if (int_dec == 0) // If zero, then post result
{
int_dec = INT_DEC; // Reset counter
for(i=0; i<ANALOG_INPUTS; i++)
{
Result[i] = accumulator[i] >> 8; // ## Copy decimated values into Result
accumulator[i] = 0L; // Reset accumulators
}
}
amux_convert = amux_input; // now that conversion results are
// stored, advance index to the analog
// input currently selected on the mux
}
Could anyone help on the query? I am just starting to refresh my binary maths... (Note : At the line with ## please read the "Result" followed by an i within square brackets . So now you will understand why everything after that point is in Italics !! ) Thanks Raghu |
| Topic | Author | Date |
| Integrate decimate... | 01/01/70 00:00 | |
| Strength reduction | 01/01/70 00:00 | |
| >> = Divide and << = Multiply | 01/01/70 00:00 | |
| Decimating | 01/01/70 00:00 | |
| I have also used this approach | 01/01/70 00:00 | |
| Thought process in frequency domain.. | 01/01/70 00:00 | |
| Low-pass filter | 01/01/70 00:00 | |
| Low pass filter selection... | 01/01/70 00:00 | |
| Sample a longer run at high frequency and analyse | 01/01/70 00:00 | |
| Good suggestion | 01/01/70 00:00 | |
| For your application... | 01/01/70 00:00 | |
| Rooling average concept... | 01/01/70 00:00 | |
| Moving Average Filter = Rolling Average Filter | 01/01/70 00:00 | |
| General concept vs. specific algorithm. | 01/01/70 00:00 | |
| Correlated and uncorrelated noise | 01/01/70 00:00 | |
| Your language ... | 01/01/70 00:00 | |
| 'Synchronous'? | 01/01/70 00:00 | |
| Similar but not identical meaning | 01/01/70 00:00 | |
Yes, sounds waayyy better... | 01/01/70 00:00 |



