Hi,
I am using the following code to read the internal temps and I get erratic readings, 83, 79, 80, 78, 92, 79...
What would cause this, and how to mitigate?
Thanks, Tom
while(REFCTL0 & REFGENBUSY); // If ref generator busy, WAIT REFCTL0 |= REFVSEL_0 + REFON; // Enable internal 1.2V reference ADC12CTL0 &= ~ADC12ENC; // Disable ADC12 ADC12CTL0 = ADC12SHT0_8 + ADC12ON; // Set sample time ADC12CTL1 = ADC12SHP; // Enable sample timer ADC12CTL3 = ADC12TCMAP; // Enable internal temperature sensor ADC12MCTL0 = ADC12VRSEL_1 + ADC12INCH_30; // ADC input ch A30 => temp sense while(!(REFCTL0 & REFGENRDY)); // Wait for reference generator to settle ADC12CTL0 |= ADC12ENC | ADC12SC; // Start sampling/conversion while (!(ADC12IFGR0 & BIT0)); // Is the sample ready? temp = ADC12MEM0; // Read conversion result