CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

Connect LM35D temperature sensor to ADC

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
STIX



Joined: 17 Jun 2006
Posts: 12

View user's profile Send private message

Connect LM35D temperature sensor to ADC
PostPosted: Mon Jun 19, 2006 1:58 pm     Reply with quote

I have attached a LM35D temperature sensor to pin AN0 on my PIC16F877A microcontroller. The output of the sensor is connected straight to AN0. The sensor measures room temperature and the ADC on the microcontroller will record the information.

There is this problem that I've noticed. When there is no program in the microcontroller and I power up the sensor and microcontroller, the voltage reading I get from the sensor output is roughly the room temperature (i.e. 0.24V indicating 24�C). However, when I put a program on the microcontroller (something like turn on LEDs, I have 2 LEDs connected to pins RB4 and RB7 on the microcontroller), the voltge reading I get from the temperature sensor output is something like 0.456V......I don't think this is right because the room temperature is still 24�C.

Before I attempt to write any ADC code to record the temperature, I want to know if what I'm getting is correct or not. Can anyone tell me if this is some hardware issue or is there a special way to connect the temperature sensor to the microcontroller? Thanks.
rwyoung



Joined: 12 Nov 2003
Posts: 563
Location: Lawrence, KS USA

View user's profile Send private message Send e-mail

PostPosted: Mon Jun 19, 2006 3:43 pm     Reply with quote

Consult the data sheet for your particular PIC as to what the PORT A pins do at reset/powerup.

Look at the LST file generated by the compiler to see what it is doing with the PORT A pins.
_________________
Rob Young
The Screw-Up Fairy may just visit you but he has crashed on my couch for the last month!
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group