Part Number: MSP-EXP430G2
Other Parts Discussed in Thread: MSP430G2553
Tool/software: Code Composer Studio
I need to measure Vcc (applied voltage) using ADC10 in MSP430G2553. I tried the following code.
int voltageMeasure()
{
int vol = 0;
ADC10CTL1 = INCH_11; // AVcc/2
ADC10CTL0 = SREF_1 + REFON + REF2_5V + ADC10ON + ADC10SHT_3 + ADC10IE; //With REF2_5V
// ADC10CTL0 = SREF_1 + ADC10SHT_3 + REFON + ADC10ON + ADC10IE; //Without REF2_5V
ADC10CTL0 |= ENC + ADC10SC; // Sampling and conversion start
__bis_SR_register(CPUOFF + GIE); // LPM0 with interrupts enabled
vol = ADC10MEM;
ADC10CTL0 &= ~ENC; //disable adc conv
return vol;
}
The problem is that if I use REF2_5V, the value of ADC10MEM increases with the increase in applied Vcc from 2.5 V to 3.6V but from 1.8V to 2.6V (ADC10MEM) value remains constant, i.e., 522.
But when I don't use REF2_5V, the value of AD10MEM increases with the increase in applied Vcc from 1.8V to 3.0V but remains constant from 3.1V to 3.6V.
Now, my question is that how can I accurately measure applied Vcc of MSP430G2553 without any extra component?
Following id the table and chart of values. Red highlighted values of AD10MEM are the constant ones corresponding to the applied voltage Vcc.
PS: The applied voltage in the table is quite accurate as I used the power supply available in my lab. Moreover, I used UART to get data on the PC terminal.
