Digital thermometer is used for determining room temperature. It is basic project for beginners to understand functions of different pins of PIC16F877A.It is made by using analog-to-digital conversion(ADC) function in PIC16F877A & seven segment display(SSDs) using LM35 as temperature sensor.
Sensors are widely used for temperature measurement but LM35 series is precision Integrated Circuit Centigrade Temperature Sensor . It is low cost and doesn’t require any external calibration. It is produced by Texas Instruments.It can operate over a -55 °C to 150 °C temperature range. Its output voltage varies linearly with centigrade temperature.It draws very less current(60uA) from the supply so it has very less self heating.The voltage output (in volts) of the sensor is:
(ADC result × 5) / 1023
The temperature in degree Celsius is:
Sensor output × 1000 / 10 = Sensor output × 100
Pin layout of the sensor is as follows:
Pin 1-VDD
Pin 2-Output of the sensor
Pin 3-VSS
To understand more better, check out its datasheet from the following link:
We can also use a buzzer in digital thermometer so that when a temperature rises above a particular value it starts beeping. This can be used in fire alarms.
MPLAB PROGRAMMING USING HI-TECH PIC16 COMPILER
#include<htc.h>
#define _XTAL_FREQ 4000000
int h;
int adc();
int adc()
{
ADCON1=0x80;
ADCON0=0x01;
ADGO=1;
while(ADGO==1);
h=ADRESH;
h<<8;
h=h+ADRESL;
return(h);
}
main()
{
int i,a,x,t,b,arr[]={0x03,0x9f,0x25,0x0d,0X99,0X49,0Xc1,0x1f,0x01,0x19};
TRISB=0x00;
TRISC=0x00;
TRISD=0x00;
PORTB=0xff;
PORTD=0x00;
while(1)
{
t=(adc()*500)/1024;
a=t/10;
b=t%10;
if(t>=25)//this is for buzzer
{
PORTD=0x02;
}
PORTC=0x02;
PORTB=arr[a];
__delay_ms(5);
PORTB=0xff;
PORTC=0x01;
PORTB=arr[b];
__delay_ms(5);
PORTB=0xff;
}
}
This program includes multiplexing of common anode seven segment displays . So you need to give 0 at pins to glow respective leds.
CIRCUIT DIAGRAM:
Put lm35 away from voltage regulator so that its heating effect does not interfere with the reading.
-ABHISHEK KATHPAL
your post is interesting and useful. lista de email lista de email lista de email lista de email lista de email
Good day very nice blog!! Man .. Excellent ..
Wonderful .. I will bookmark your blog and take the feeds also?
I’m happy to seek out so many useful information here in the put up, we need work out more strategies in this regard, thank you for sharing. . . . . .