I have set-up the A2D on a FRDM-KE06Z board to monitor the Thermistor on channels 12 and 13, and also channel 15. The voltage I read on channels 12 and 13 never changes. Even though I put the board in the freezer for a couple hours, or touch a hot soldering iron to the Thermistor, I never see any change in the voltage. Any idea what's wrong?
Following is what I get for a channels 12, 13, 15, and some internal channels 22, 23, 29, and 30
Thermistor High Volts: 2.474
Thermistor Low Volts: 0.823
Thermistor Temperature is: 25.0 degrees
ADC Channel 15 Volts: 1.105
Internal Temp sensor Volts: 1.461
Internal Temperature is: 22.1 degrees
Bandgap Volts: 1.067
VREFH Volts: 3.301
VREFL Volts: 0.000
I'm confident my A2D set-up is correct, since I get good readings on these other channels. That said, here's the A2D initialization code:
| SIM_SCGC |= SIM_SCGC_ADC_MASK; //Enable the clock to the ADC |
| //Clock must always be < 8MHz; must be < 4MHz in Low Pwr mode |
| ADC_SelectClock(ADC_BASE_PTR, CLOCK_SOURCE_BUS_CLOCK); // Bus Clock = 20MHz |
| ADC_SelectClockDivide(ADC_BASE_PTR, ADC_ADIV_DIVIDE_4); //20MHz / 4 = 5 MHz |
| ADC_SetMode(ADC_BASE_PTR, ADC_MODE_12BIT); |
| //Setup the pins assoc with the following channels to ADC only - no GPIO functionality |
| ADC_APCTL1 = ((uint16_t)1<<ADC_CHANNEL_AD12)|((uint16_t)1<<ADC_CHANNEL_AD13)|((uint16_t)1<<ADC_CHANNEL_AD15); |
| ADC_SetLongSample(ADC_BASE_PTR); // Longer Sample time - higher accuracy! |
| NVIC_EnableIRQ(INT_ADC); | //enable the ADC interrupt in NVIC. | | |
| | //Interrupt enable bit in ADC_SC1 is enabled later | | | | |
Reading the ADC is simple:
| uint32_t u32temp; u32temp = ADC_SC1; u32temp &= ~ADC_SC1_ADCH_MASK; ADC_SC1 = u32temp | 0xC; //This initiates the A2D conversion |
while( !ADC_IsCOCOFlag(pADC) ); //Wait for the conversion to complete
return ADC_ReadResultReg(pADC);
Any idea why the Thermistor voltage doesn't change with temperature?
Thanks for your help!
Sean