Tool/software: Code Composer Studio
this is my code
#include <msp430.h>
#include<math.h>
#include<stdio.h>
//sample RTD code for wheatstone Bridge as per schematic A0
#define GAIN 31.14 //gain of opamp
#define VSOURCE 3.3 //vsource
#define R0 100 //resistance of rtd at 0
#define Temp_Coeff 0.00385 //tempreture coeff is for the platinum
void init_adc() //no interrupts
{
ADC12CTL0 = ADC12SHT02|ADC12ON; //1.selects the 16 cycle per sample 2.adc on|ADC12MSC
ADC12CTL1 = ADC12SHP|ADC12CONSEQ_2; //1.signal source from the sampling timer 3.repeate single channel
ADC12CTL2 = ADC12TCOFF|ADC12RES_2; //1.make internal temp senser off 2.select 12 bit resolution
ADC12MCTL0 =ADC12SREF_2 ; //1.To make External Ref Enable for the channel A0
}
int main(void)
{
WDTCTL = WDTPW | WDTHOLD; // stop watchdog timer
P6SEL |= BIT0;
init_adc();//initlialize the ADC
float Vout,Rrtd,X,Temp,LSB;
//while(1)
//{
ADC12CTL0 |=ADC12ENC|ADC12SC;//enable the adc and sampling and conversion start
while (!(ADC12IFG & BIT0));
LSB=33/40950;
Vout =ADC12MEM0;
Vout = Vout*LSB/GAIN;
Vout = Vout*1000;
printf("vout %f\n",Vout);
X=((Vout/VSOURCE)-0.5);//X=(Vout/Vsource-1/2)
printf("X== %f\n",X);
Rrtd= ((X*R0/(1-X)));
printf("value of RTD %f\n",Rrtd);
Temp=((Rrtd-R0)/(R0*Temp_Coeff));
//}
printf("Tempreture of is -------> %f\n",Temp);
return 0;
}
the float value does not print on to the console
the output i get on the console as
Vout
X==
Rrtd
Temp
float value not get printed help with this..
thank you.