LM35DZ connet to pic16F877a using picbasic pro program

Status
Not open for further replies.

lampaloon

Newbie level 4
Joined
Aug 6, 2010
Messages
6
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Location
hongkong
Activity points
1,317
hey~~~i need a help..~i had write the programming code for lm35DZ,but i cnt get the expected result.when i connect the lm35dz with pic, the temperature value was changed contineusly and the result value was wrong. even though i take out the lm35DZ, the lcd display also will display the temperature value~~so weird~~
here is my code:

DEFINE LCD_DREG PORTD
DEFINE LCD_DBIT 4
DEFINE LCD_RSREG PORTE
DEFINE LCD_RSBIT 0
DEFINE LCD_EREG PORTE
DEFINE LCD_EBIT 2
DEFINE LCD_BITS 4
DEFINE LCD_LINES 2

DEFINE ADC_BITS 10
DEFINE ADC_CLOCK 3
DEFINE ADC_SAMPLEUS 50

Low PORTE.1
temp var word
temperature var word
lm35 var PORTA.0
TRISA = %11111111
ADCON1= %10001110

Pause 100
Lcdout $fe, 1

main:
Lcdout " Automated H&T "
Pause 500
Lcdout $fe, $c0, "Control System"
Pause 500

Again:
ADCIN lm35, temp
pause 500
temperature=(temp*5000)*/1250
Lcdout $fe,1
Lcdout "Temp =",dec2 (temperature/100),".",dec1(temperature//100),$DF,"C"
Pause 500

Goto Again
End
 

hi!

-> temperature=(temp*5000)*/1250 is not good ; 1024 * 5000 = 5.120.000 ; temperature is defined as word (max 65535).

so, please adjust this line!
 
Please i need help to display temperature readings from a temperature sensor via rf (transceiver modules ER400) to a pic 18f4550. help please
 

hmmm~~~can give me more detail~explanation~

for using picbasic pro~~~we need to connect the Vref?for ADC?
 

i need codes in C for RF transmission
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…