Hello Together,
i´m trying to measure the degital value of a PT100 output voltage circuit. The Voltage @ 25°C is 1,092V. I use the 2.5 Vref+. i used the P1.0 as input.
The Problem is that i get not stable values. so the digital values vary with +-20 per second. so i get values from 420 until 460. Normally the value should be 446 and stable for some secondes.
can someone help me? it may be that i don´t understand the sampling time or the sampling and converting initialization.
//***********************************************************
// Temperature measurement with PT100
//Aymen Ben Hafsa
// Juni/2012
//***********************************************************
#include <msp430g2553.h>
//#ifndef TIMER0_A1_VECTOR
//#define TIMER0_A1_VECTOR TIMERA1_VECTOR
//#define TIMER0_A0_VECTOR TIMERA0_VECTOR
//#endif
volatile long tempRaw;
void main(void)
{
WDTCTL = WDTPW + WDTHOLD; // Stop watchdog timer
if (CALBC1_1MHZ ==0xFF || CALDCO_1MHZ == 0xFF)
// If calibration data is erased
BCSCTL1 = CALBC1_1MHZ; // Set range
DCOCTL = CALDCO_1MHZ; // Set DCO step + modulation
BCSCTL3 |= LFXT1S_2; // LFXT1 = VLO
IFG1 &= ~OFIFG; // Clear OSCFault flag
BCSCTL2 |= SELM_0 + DIVM_3 + DIVS_3; // MCLK = DCO/8
while(1)
{
ADC10CTL1 = INCH_1 + CONSEQ_0 ; // Temp Sensor ADC10CLK and P1.0 as ADC input
ADC10CTL0 = SREF_1 + ADC10SHT_3 + REFON + ADC10ON + REF2_5V ;
ADC10AE0 |= 0x002; // Analog enable for the P1.0
_delay_cycles(5); // Wait for ADC Ref to settle
ADC10CTL0 |= ENC + ADC10SC; // Sampling and conversion start
_delay_cycles(100);
ADC10CTL0 &= ~ENC;
ADC10CTL0 &= ~(REFON + ADC10ON);
tempRaw = ADC10MEM;
P1OUT |= BIT0;
}
}
Best regards
Aymen

