Lm35 Temperature Sensor Programme
Lm35 Temperature Sensor Programme
Lm35 Temperature Sensor Programme
h>
#fuses HS,NOPROTECT,NOWDT,PUT
#include <lcd.c>
#define LCD_ENABLE_PIN PIN_B6 //change here according to ur pin from PIC to LCD
long val=0;
float temp=0;
float overall_delay_time, c;
void main()
setup_adc_ports(RA0_ANALOG);
setup_adc( ADC_CLOCK_INTERNAL );
set_adc_channel(0);
lcd_init();
while(true)
delay_ms(100);
temp = (val/1023.0)*5*100; //convert val to temperature in celcius
lcd_init();
printf(lcd_putc,"temp = %4.2f",temp);
if(temp<100)
count_time_s=0;
count_time_m=0;
printf(lcd_putc,"time = HEATING");
else
count_time++;
/*
*/
c=1/overall_delay_time;
count_time_s=count_time/c;
{
if (count_time>=(60*c))
printf(lcd_putc,"time=%dm%ds",count_time_m,count_time_s);
else
printf(lcd_putc,"DONE");
delay_ms(400);