I'm getting some radically incorrect-seeming values from the internal temp sensor on the ADC on my MSP430. I copied and pasted code from the example fiile msp430f66xx_adc_10.c:
ADC12_A_clearInterrupt(ADC_BASE,ADC12IFG0); REFCTL0 &= ~REFMSTR; // Reset REFMSTR to hand over control to // ADC12_A ref control registers ADC12CTL0 = ADC12SHT0_8 + ADC12REFON + ADC12ON; // Internal ref = 1.5V ADC12CTL1 = ADC12SHP; // enable sample timer ADC12MCTL0 = ADC12SREF_1 + ADC12INCH_10; // ADC i/p ch A10 = temp sense i/p // ADC12IE = 0x001; // ADC_IFG upon conv result-ADCMEMO for(nTimeout=0;nTimeout<30;nTimeout++) // Delay to allow Ref to settle ADC12CTL0 |= ADC12ENC; ADC12CTL0 &= ~ADC12SC; ADC12CTL0 |= ADC12SC; // Sampling and conversion start while( !(ADC12_A_getInterruptStatus(ADC_BASE,ADC12IFG0)) ); nTimeout = ADC12MEM0; // Temperature in Celsius // ((A10/4096*1500mV) - 680mV)*(1/2.25mV) = (A10/4096*666) - 302 // = (A10 - 1858) * (666 / 4096) nTimeout = ((nTimeout - 1858) * 666) / 4096; // Temperature in Fahrenheit // Tf = (9/5)*Tc + 32 nTimeout = ((nTimeout - 1858) * 1199) / 4096 + 32;
..I'm getting values in ADC12MEM0 upwards of 2150 (decimal), whici converts into a pretty weird temperature considering the ambient in here is about 73f.
Is there anything blantantly wrong here? I assumed that a sample would work (all the otrhers I've looked at have).
All info appreciated!
Ed Averill