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
Posted: Mon Jun 19, 2006 3:43 pm
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!
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