| Author |
Message |
mikesmixes
Joined: 17 May 2004 Posts: 7
|
17 May 2004 21:39 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
|
|
| Back to top |
|
 |
Elavionic
Joined: 06 Apr 2002 Posts: 91 Helped: 1 Location: Portugal
|
17 May 2004 22:11 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).
|
|
| Back to top |
|
 |
mikesmixes
Joined: 17 May 2004 Posts: 7
|
17 May 2004 22:19 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?
|
|
| Back to top |
|
 |
Google AdSense

|
17 May 2004 22:19 Ads |
|
|
|
|
|
|
| Back to top |
|
 |
nooknikz
Joined: 22 Apr 2002 Posts: 404 Helped: 22 Location: thailand
|
18 May 2004 3:57 temperature adc conversion to lcd |
|
|
|
|
you can see example in book : Experimenting with the PicbasicPro compiler
here : http://www.edaboard.com/viewtopic.php?t=62363&start=0&postdays=0&postorder=asc&highlight=experimenting+picbasic
|
|
| Back to top |
|
 |
hugo
Joined: 01 Jan 1970 Posts: 286 Helped: 27 Location: canada
|
18 May 2004 3:58 displaying temp on lcd |
|
|
|
|
Hi,
Even though it's for LM 34 I think your problem is solved:
http://www.rentron.com/PicBasic/LM34.htm
Bye!
|
|
| Back to top |
|
 |
Elavionic
Joined: 06 Apr 2002 Posts: 91 Helped: 1 Location: Portugal
|
20 May 2004 15:30 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.
|
|
| Back to top |
|
 |
microcozmoz
Joined: 12 Jul 2003 Posts: 20 Helped: 1
|
22 May 2004 23:47 lcd reading temperature |
|
|
|
|
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
Define ADC_BITS 10 ' ADC result is 10 bit
Define ADC_CLOCK 1 ' ADC clock source( foscillator/8 )
DEFINE ADC_SAMPLEUS 50 ' ADC sampling time us
DEG CON 223 ' you can write an celcius mark on lcd
AD_Res VAR WORD '
C VAR BYTE '
TEMPERATURE READİNG :
ADCIN 0, AD_Rez ' Read channel 0 to AD_Rez (0-1023)
AD_Rez = (AD_Rez */ 500)>>2 ' equates to: AD_Rez * 500)/1024
DİSPLAY TEMPERATURE ON LCD:
LCDOUT $FE,$C0,"TEMP:",DEC2 AD_REZ,DEG,"C"
|
|
| Back to top |
|
 |