Part Number: MSP430FR2311
In MSP430FR2311 right now I'm working with ADC. In that I'm taking 100 multiple ADC samples to make more accuare final ADC Count(Average Value).
But in that I'm not getting enough stable ADC Count.
I have also paste code and 100 sample adc count in the form array as well.
I have a calibrator voltage source which is stable 1.34v.
Min value from ADC count Array is = 865
Max value from ADC count Array is = 939
There is a huge difference between them, we can say it is around 74 count.
Can any one help me to figure out this issue?
I mean how to make more ADC count value stable.
#include <msp430fr2311.h> unsigned int ADC_Result[100]; int Index = 0; long ADC_AVG_Count = 0; int J = 0, K = 0; //void Clear_Buff(); int main(void) { WDTCTL = WDTPW | WDTHOLD; // Stop WDT // Configure ADC A1 pin P1SEL0 |= BIT5; P1SEL1 |= BIT5; // Disable the GPIO power-on default high-impedance mode to activate // previously configured port settings PM5CTL0 &= ~LOCKLPM5; // Configure ADC10 ADCCTL0 |= ADCSHT_7 | ADCON; // ADC Sample and Hold Time = 192 cycles, ADC on bit set ADCCTL1 |= ADCSHP | ADCSSEL_1; //Sample and Hold pulse mode select, Clk = ACLK ADCCTL2 |= ADCRES; //10 - bit Resolution ADCIE |= ADCIE0; //Interrupt Enable ADCMCTL0 |= ADCINCH_5 | ADCSREF_1; //A5 channel select, ref+ = 1.5v, ref- = Vss; // Configure reference PMMCTL0_H = PMMPW_H; // Unlock the PMM registers PMMCTL2 |= INTREFEN; // Enable internal reference __delay_cycles(400); // Delay for reference settling while(1) { ADCCTL0 |= ADCENC | ADCSC; // Sampling and conversion start __bis_SR_register(GIE ); // Global interrupts Enable } } // ADC interrupt service routine #if defined(__TI_COMPILER_VERSION__) || defined(__IAR_SYSTEMS_ICC__) #pragma vector=ADC_VECTOR __interrupt void ADC_ISR(void) #elif defined(__GNUC__) void __attribute__ ((interrupt(ADC_VECTOR))) ADC_ISR (void) #else #error Compiler not supported! #endif { switch(__even_in_range(ADCIV,ADCIV_ADCIFG)) { case ADCIV_NONE: break; case ADCIV_ADCOVIFG: break; case ADCIV_ADCTOVIFG: break; case ADCIV_ADCHIIFG: break; case ADCIV_ADCLOIFG: break; case ADCIV_ADCINIFG: break; case ADCIV_ADCIFG: ADC_Result[Index] = ADCMEM0; Index++; if(Index >= 100) { Index = 0;
__no_operation(); } break; default: break; } }
///ADC Count Array (100 Samples):
| [0] | 930 |
| [1] | 932 |
| [2] | 918 |
| [3] | 917 |
| [4] | 914 |
| [5] | 913 |
| [6] | 939 |
| [7] | 895 |
| [8] | 920 |
| [9] | 895 |
| [10] | 910 |
| [11] | 929 |
| [12] | 875 |
| [13] | 892 |
| [14] | 916 |
| [15] | 927 |
| [16] | 917 |
| [17] | 922 |
| [18] | 915 |
| [19] | 930 |
| [20] | 920 |
| [21] | 912 |
| [22] | 924 |
| [23] | 867 |
| [24] | 911 |
| [25] | 896 |
| [26] | 910 |
| [27] | 919 |
| [28] | 909 |
| [29] | 922 |
| [30] | 909 |
| [31] | 924 |
| [32] | 922 |
| [33] | 917 |
| [34] | 911 |
| [35] | 905 |
| [36] | 877 |
| [37] | 925 |
| [38] | 902 |
| [39] | 865 |
| [40] | 910 |
| [41] | 931 |
| [42] | 895 |
| [43] | 903 |
| [44] | 910 |
| [45] | 888 |
| [46] | 913 |
| [47] | 898 |
| [48] | 890 |
| [49] | 902 |
| [50] | 928 |
| [51] | 931 |
| [52] | 918 |
| [53] | 917 |
| [54] | 931 |
| [55] | 930 |
| [56] | 906 |
| [57] | 935 |
| [58] | 907 |
| [59] | 911 |
| [60] | 925 |
| [61] | 919 |
| [62] | 895 |
| [63] | 908 |
| [64] | 915 |
| [65] | 899 |
| [66] | 920 |
| [67] | 906 |
| [68] | 912 |
| [69] | 928 |
| [70] | 927 |
| [71] | 927 |
| [72] | 908 |
| [73] | 920 |
| [74] | 917 |
| [75] | 914 |
| [76] | 901 |
| [77] | 885 |
| [78] | 913 |
| [79] | 896 |
| [80] | 933 |
| [81] | 902 |
| [82] | 918 |
| [83] | 922 |
| [84] | 920 |
| [85] | 908 |
| [86] | 915 |
| [87] | 911 |
| [88] | 928 |
| [89] | 916 |
| [90] | 932 |
| [91] | 929 |
| [92] | 917 |
| [93] | 894 |
| [94] | 934 |
| [95] | 869 |
| [96] | 928 |
| [97] | 921 |
| [98] | 910 |
| [99] | 918 |