## How to Caculate the Voltage of MSP430AFE253 ?

mome
Beginner
Posts: 2
Joined: Thu Apr 27, 2017 6:01 am

### How to Caculate the Voltage of MSP430AFE253 ?

Good day,
The voltage I sampled is 0.1~1.85mV and the chip I used is MSP430AFE253IPW.( This is the datsheet of MSP430AFE253IPW: http://www.kynix.com/uploadfiles/pdf228 ... 253IPW.pdf )I want to ask two questions:
1).Why the ADC value is same whether to use non-automatic gain or automatic gain-change ?
2).How to caculate the voltage value when automatic gain is 32 ?
This is a part of code:
void main(void)
{
volatile unsigned int i; // Use volatile to prevent removal

// by compiler optimization
WDTCTL = WDTPW + WDTHOLD; // Stop WDT
// Set P1.0, P1.1 to output
_EINT();
SD24CTL = SD24REFON + SD24SSEL0+SD24DIV_3; // 1.2V ref, SMCLK,SMCLK 8 fractional frequency
//SD24CCTL0 |= SD24GRP; // Group with CH1 be set，2's complement data format of SD24_A
SD24INCTL0 = SD24INCH_0+SD24GAIN_32; // Set channel A0+/- 32 doubly??
SD24CCTL0 |= SD24IE+SD24OSR_512; // Single conv,enable interrupt Sampling rate is 512 data format
SD24CCTL2 |= SD24IE+SD24OSR_512; // Enable interrupt
SD24INCTL2 = SD24INCH_2+SD24GAIN_16;
for (i = 0; i < 0x3600; i++); // Delay for 1.2V ref startup
SD24CCTL0 |= SD24SC;
SD24CCTL2 |= SD24SC; // Set bit to start conversion
__bis_SR_register(LPM0_bits + GIE); // Enter LPM0 w/ interrupts
}

The following picture is about the sampling value.
6.1.1.png (51.83 KiB) Viewed 167 times