Hi,
I am reading the ADC output from ADC12MEM0 but I am confused about the conversion into voltage values. I went through the datasheet and am ending up with weird voltage values. Below is the configuration I used -
ADC12CTL0 = ADC12SHT0_0 | ADC12ON;
ADC12CTL1 = ADC12SHP | ADC12SHS_7 | ADC12CONSEQ_2;
ADC12CTL2 |= ADC12RES_2;
ADC12MCTL0 = ADC12INCH_2 |ADC12VRSEL_1 | ADC12EOS; // VR+ = VREF buffered, VR- = AVSS
ADC12IER0 |= ADC12IE0;
ADC12CTL0 |= ADC12ENC | ADC12SC;
From the above I understand that I need to convert the hex value into 2's complement and multiply it with Vref and divide by 4096. (I am not sure if the 2's complement is absolutely required.) But what value am I supposed to use for Vref? For example, when a constant voltage input of 2.5V is connected to the ADC input channel, I read 0x0034 from the ADC12MEM0 register. Can someone please the right way to calculate the original 2.5V from this 0x0034 hex value?
One more question I do have is what will be the maximum voltage that can be read by the ADC? When I connect 3.3V or 5V to the ADC input channel, I see 0x0FFFh in both the cases.
Thank you!