Professional Documents
Culture Documents
Temperature Sensor by LM335 LCD PIC16F877A
Temperature Sensor by LM335 LCD PIC16F877A
Temperature Sensor by LM335 LCD PIC16F877A
BEST OF LUCK.
Circuit Diagram
Code:
// Program to make a Liquid
/*Header******************************************************/
level
int temp;
char txt[8];
unsigned char ch;
//
// Declare variables
char *text;
//
long tlong;
//
Lcd_Cmd(_LCD_CLEAR);
Lcd_Out(1,1,text);
Delay_ms(1000);
Lcd_Cmd(_LCD_CLEAR);
text = "Engnr Rana M";
Lcd_Out(1,1,text);
Delay_ms(1000);
text = " Shakeel ";
Lcd_Out(2,1,text);
Delay_ms(2000);
Lcd_Cmd(_LCD_CLEAR);
text = " Temperature ";
Lcd_Out(1,1,text);
}
void main()
{
TRISA = 0xFF;
trisB=0x00;
4
portb=1;
adcon1=0x00;
Lcd_Init();
Lcd_Cmd(_LCD_CURSOR_OFF);
Lcd_Cmd(_LCD_CLEAR);
ADCON1 = 0x82;
TRISA = 0xFF;
Delay_ms(1000);
introduction (void);
text = "Temp: ";
Delay_ms(1000);
while (1) {
adc_rd = ADC_Read(0);
Lcd_Out(2,1,text);
temp=(adc_rd - 559.567) / 2 ;
inttostr(temp,txt);
Lcd_Out(2,5,txt);
Lcd_Chr_CP('C');
// display character
Delay_ms(1);
}
}