here is the code im using.... i ve come up with formulae for temperature through fit equations in excel...by drawing a curve for T vs R using the lookup table for the thermistor..! now the problem is the lcd is not displaying decimal values and giving me "???" wen i declare float type..!am using eclipse ide!
I'm gettin the resistance value wen I put some value like 2.2 instead of x!but wen I leave it as x nothin is being displayed!and float or double both are not working I'm jus not able to display decimal!LCD is working fine for other programs or wen I display the output of readadc it's showing me 450 somethin which is fine so no problem wid LCD!wat command can I use other than sprintf?
#include <avr/io.h>
#include "lcd_lib.h"
#include <util/delay.h>
#include "adc_lib.h"
#include<stdio.h>
void main ( )
{
float x,y,t;
char a[15];
LCDinit();
LCDclr( );
ADCinit();// Initializes ADC in 10 bit mode
while(1)
{ x = read_adc(0)* 5/1024; // returns the digital value of the analog i/p connected to pin 0 of port A in terms of voltage
y = 10000 * (x/5-x);//resistance of thermistor
if(30000<y<12200)//temperature calculation
{t = (-1E-12)*(y*y*y) + (1E-07)*y*y - 0.0039*y + 54.581;
}
if(12199<y<5500)
{t = (-2E-11)*(y*y*y) + (7E-07)*y*y- 0.0105*y + 80.776;
}
if(5499<y<2700)
{t = (-2E-10)*(y*y*y) + (3E-06)*y*y - 0.0248*y + 106.77;
}
if(2699<y<1300)
{t = (-2E-09)*(y*y*y) + (1E-05)*y*y - 0.0538*y + 132.94;
}
sprintf(a,"Temperature = %f",t);
LCDclr();
LCDstring(a,13);
_delay_ms(300);
}
}