Other Parts Discussed in Thread: LMT85-Q1, MSP-FET
This is my circuit. I'm feeding the LMT85-Q1 from the P2.1 of the MCU. Pin 2 on the MCU (A0) is used for reading the output from the sensor.
#include <msp430.h> /** * main.c */ // Declare & initialize some variables volatile unsigned counter = 0; volatile unsigned temp_arr[20]; void main(void) { WDTCTL = WDTPW | WDTHOLD; // stop watchdog timer // Feed the temp. sensor P2DIR = 0x02; P2OUT = 0x02; // Set the ADC from the documentation ADC10CTL0 = SREF_0 + ADC10SHT_3 + ADC10ON + ADC10IE + MSC; ADC10CTL1 = INCH_0 + ADC10DIV_1 + ADC10SSEL_0 + CONSEQ_2; ADC10DTC0 = ADC10CT; // Start ADC10 module ADC10CTL0 |= ENC + ADC10SC; // Enable interrupt(s) __enable_interrupt(); } #pragma vector=ADC10_VECTOR __interrupt void ADC10_ISR(void) { // change to ADC10_banana // interrupt logic goes here if(counter < 20) { // Dump ADC10MEM value into the <array> on position/index <counter> temp_arr[counter] = ADC10MEM; // Increment counter counter++; } else { // Reset counter to avoid <array> "out of bounds" counter = 0; // Turn off ACD10 ADC10CTL0 &= ~(ENC + ADC10SC); } }
The voltage returns do not correspond to the ambiental temperature:
What am I missing?
According to the documentation, 408 mV translates to 138C.