View previous topic :: View next topic |
Author |
Message |
Kenny
Joined: 07 Sep 2003 Posts: 173 Location: Australia
|
|
Posted: Mon Mar 02, 2009 10:13 pm |
|
|
The LM34 can go down to about 5F (-15C) without using a negative supply.
The sensitivity is 18mV/degree C (10mV/degree F by 9/5). |
|
|
Mamat
Joined: 20 Jan 2011 Posts: 9
|
Re: LM35 temp sensor reading (10°C off) |
Posted: Wed Feb 16, 2011 10:11 am |
|
|
STIX wrote: | Hi:
I connected a LM35 temperature sensor to my PIC16F877A MCU to take temperature readings. The following is my code:
Code: |
#include <16F877A.h>
#device *=16
#device ADC=10
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#fuses HS,NOWDT,NOPUT,NOPROTECT,NODEBUG,BROWNOUT,NOLVP,NOCPD,NOWRT
#USE DELAY(clock = 4000000)
#use RS232(baud = 9600, xmit = PIN_C6, rcv = PIN_C7)
void main ()
{
int16 value, value1;
setup_adc (ADC_CLOCK_DIV_8);
setup_adc_ports (AN0);
set_adc_channel (0);
while (1)
{
delay_ms (500);
value = read_adc ();
value1 = 5 * value * 100/1024;
printf ("Temp:%5.1fC\n\r", (float)value1);
}
}
|
|
How the code if I have two lm34 to use 2 analog input ? |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9221 Location: Greensville,Ontario
|
|
Posted: Wed Feb 16, 2011 2:01 pm |
|
|
Also add 'errors' to the options in USE RS232(....) ! |
|
|
|