temperature sensor by lm335 lcd pic16f877a

6
Temperature sensor by LM335, for quire contact: [email protected] Temperature sensor by LM335, LCD, PIC16F877A The LM335 temperature sensor is an easy to use, cost-effective sensor with decent accuracy (around +/- 3 degrees C calibrated). The sensor is essentially a zener diode whose reverse breakdown voltage is proportional to absolute temperature. Software used: Than the micro controller read this voltage of LM35 and after calculations display on the LCD a. MickroC PRO b. Proteous 7.7 BEST OF LUCK. Engr Rana Muhammad Shakeel [email protected] +92-333-4962507 https://www.facebook.com/EngnrShakeel plz like my page: https://www.facebook.com/Electrical4Electronics 1 Engnr Rana M Shakeel, +92-333-4962507 | [email protected]

Upload: aw-andrei

Post on 05-Feb-2016

30 views

Category:

Documents


1 download

DESCRIPTION

Temperature Sensor by LM335 LCD PIC16F877A

TRANSCRIPT

Page 1: Temperature Sensor by LM335 LCD PIC16F877A

Temperature sensor by LM335, for quire contact: [email protected]

Temperature sensor by LM335, LCD, PIC16F877AThe LM335 temperature sensor is an easy to use, cost-effective sensor with decent accuracy (around +/- 3 degrees C calibrated). The sensor is essentially a zener diode whose reverse breakdown voltage is proportional to absolute temperature. Software used:

Than the micro controller read this voltage of LM35 and after calculations display on the LCD

a. MickroC PRO b. Proteous 7.7

BEST OF LUCK.

Engr Rana Muhammad Shakeel

[email protected]

+92-333-4962507

https://www.facebook.com/EngnrShakeel

plz like my page:

https://www.facebook.com/Electrical4Electronics

1 Engnr Rana M Shakeel, +92-333-4962507 |

Page 2: Temperature Sensor by LM335 LCD PIC16F877A

Temperature sensor by LM335, for quire contact: [email protected]

Circuit Diagram

2 Engnr Rana M Shakeel, +92-333-4962507 |

Page 3: Temperature Sensor by LM335 LCD PIC16F877A

Temperature sensor by LM335, for quire contact: [email protected]

Code:// Program to make a Liquid level

/*Header******************************************************/

// LCD module connections

sbit LCD_RS at RB4_bit;

sbit LCD_EN at RB5_bit;

sbit LCD_D4 at RB0_bit;

sbit LCD_D5 at RB1_bit;

sbit LCD_D6 at RB2_bit;

sbit LCD_D7 at RB3_bit;

sbit LCD_RS_Direction at TRISB4_bit;

sbit LCD_EN_Direction at TRISB5_bit;

sbit LCD_D4_Direction at TRISB0_bit;

sbit LCD_D5_Direction at TRISB1_bit;

sbit LCD_D6_Direction at TRISB2_bit;

sbit LCD_D7_Direction at TRISB3_bit;

// End LCD module connections

int temp;

char txt[8];

unsigned char ch; //

unsigned int adc_rd; // Declare variables

char *text; //

long tlong; //

3 Engnr Rana M Shakeel, +92-333-4962507 |

Page 4: Temperature Sensor by LM335 LCD PIC16F877A

Temperature sensor by LM335, for quire contact: [email protected]

void introduction (void)

{

Lcd_Cmd(_LCD_CLEAR); // LCD command (clear LCD)

text = " Tempeature "; // Define the first message

Lcd_Out(1,1,text); // Write the first message in the first line

text = "by PIC16F877A"; // Define the second message

Lcd_Out(2,1,text); // Define the first message

Delay_ms(1000);

Lcd_Cmd(_LCD_CLEAR);

text = "Engnr Rana M"; // Define the first message

Lcd_Out(1,1,text); // Write the first message in the first line

Delay_ms(1000);

text = " Shakeel "; // Define the second message

Lcd_Out(2,1,text); // Define the first message

Delay_ms(2000);

Lcd_Cmd(_LCD_CLEAR); // LCD command (clear LCD)

text = " Temperature "; // Define the first message

Lcd_Out(1,1,text);

}

void main()

{

TRISA = 0xFF;

4 Engnr Rana M Shakeel, +92-333-4962507 |

Page 5: Temperature Sensor by LM335 LCD PIC16F877A

Temperature sensor by LM335, for quire contact: [email protected]

trisB=0x00;

portb=1;

adcon1=0x00;

Lcd_Init(); // LCD display initialization

Lcd_Cmd(_LCD_CURSOR_OFF); // LCD command (cursor off)

Lcd_Cmd(_LCD_CLEAR); // LCD command (clear LCD)

ADCON1 = 0x82; // A/D voltage reference is VCC

TRISA = 0xFF; // All port A pins are configured as inputs

Delay_ms(1000);

introduction (void);

text = "Temp: "; // Define the third message

Delay_ms(1000);

while (1) {

adc_rd = ADC_Read(0); // A/D conversion. Pin RA2 is an input.

Lcd_Out(2,1,text); // Write result in the second line

temp=(adc_rd - 559.567) / 2 ;

inttostr(temp,txt); // convert integer into string

Lcd_Out(2,5,txt);

Lcd_Chr_CP('C'); // display character

Delay_ms(1);

}

}

5 Engnr Rana M Shakeel, +92-333-4962507 |