Hi, I'm acquiring the analog signals uisng CCS430F5137 and I want to smooth them by averaging the ADC samples.
I found this similar threads
Averaging with 4 samples : http://e2e.ti.com/support/microcontrollers/msp430/f/166/t/19335.aspx
Averaging with 8 samples :http://e2e.ti.com/support/microcontrollers/msp430/f/166/t/148277.aspx
The implementation of 8 samples similar above is used with ADC12 instead of ADC10 but I am not getting anything on the hyperterminal.Is there anything I need to change to use ADC10 averaging code to work with ADC12
main {
ADC channel settings() while(1) { VoltCalibrated = results[oldest]; for (i=0; i < 8; i++) VoltMeasured[i] = VoltCalibrated; VoltAverage = VoltCalibrated; VoltMeasured[VoltMeasuredPosition++] =results[oldest]; if (VoltMeasuredPosition == 8) VoltMeasuredPosition = 0; VoltAverage = 0; for (i = 0; i < 8; i++) VoltAverage += VoltMeasured[i]; VoltAverage >>= 3; // Divide by 8 to get average UART_send(VoltAverage); ADC12CTL0 |= ADC12SC; __bis_SR_register(CPUOFF + GIE); } }
#pragma vector=ADC12_VECTOR __interrupt void ADC12ISR(void) { if (oldest >= Size) { oldest =0; } else { oldest = oldest +1; } results[oldest] = ADC12MEM0; __bic_SR_register_on_exit(CPUOFF); }
I just have a doubt of how this works ( or what this will do) VoltAverage >>= 3; // Divide by 8 to get average
Can anyone suggest the changes for this.
Thanks.