Continue to Site

# displaying temperature on LCD

Status
Not open for further replies.

#### mikesmixes

##### Newbie level 4
lm35 picbasic

Hey, i am using a LM35, PIC16f877 and a 2x16 lcd screen
All i want to do is show the temperature on the lcd screen.
Anybody got some code or ideas.
Thanks

experimenting with lm35

I don´t know if you are using assembler or C , but any C compiler already has a library for LCD, so fisrt problem solved. For the LM35 you have many ways to implement it, the easier is to set the REF for ADC at PIC at a suitable level for linearity with LM35 output, i believe is 10mV/ºC or better yet use an ampop to rise the maximum temperatura you want to read at a 5V level and use direct ADC from PIC. An idea for code the code is very simple: take four ou five reading from the sensor, average them and then display it on the LCD, use a low refresh rate, the temperature change very slow, usually. I guess that 10 readings/second is enought. Hope it helps you, but never the less search code and ideas in forums for PIC (use google or this forum as a starting point).

souparnica

### souparnica

Points: 2
best temp for lcd

hey, im using pic basic. i dont understand how to make a Vref for the A/D.
What exactly does that Vref do?

you can see example in book : Experimenting with the PicbasicPro compiler

Last edited by a moderator:

displaying temp on lcd

Hi,

Even though it's for LM 34 I think your problem is solved:

Bye!

Last edited by a moderator:

lm35 en picbasic

The Vref tension is the reference voltage for the ADC conversion. Usually, and PIC works like this, Vref is the voltage equivalent to 0x3FF, full conversion. So if you want to convert an exernal tension lower then 5V, lets says max 3V, you supply 3V to Vref pin and you'll get from 0x000 (0V) to 0x3FF(3V), otherwise, using 5V ref the max bin value, from the same 3V, will be Vin*1024/Vref.

I have measured temperature with LM35 in one of my project.

Here is the code with Pic basic ,

ADCON1 = %10000010' You have to set the register first

DEG CON 223 ' you can write an celcius mark on lcd

C VAR BYTE '

DİSPLAY TEMPERATURE ON LCD:

LCDOUT $FE,$C0,"TEMP:",DEC2 AD_REZ,DEG,"C"

Status
Not open for further replies.