PDA

View Full Version : strange readings



cheezy1963
- 24th November 2007, 01:36
16f88 @ 16mhz

What would cause strange readings on AN0 specifically? Here is the scenario, simple LM35 setup feeding output directly to AN0/pin 17. The temp reading is off by a couple of degrees. If I move the connection from AN0/pin 17 to AN1/pin 18 the temp reading is correct. Same thing goes for AN2/pin 1....it reads correctly. When I scope AN0/pin 17 (with LM35 output connected) I see the the clock signal with reasonable amplitude. When I scope the other analog inputs (with the LM35 connected) I see the clock signal again but a less than half the amplitude of AN0.

I've tried different 16f88's and LM35's with the same results:)

Looking at the internal diagrams of the 16f88 I can see that what I'm looking at is the internal switch but why would it be different across the board and how do I eliminate the problem. I've tried the suggestions in the LM35 datasheet but see no changes.


Please tell me the answer is not....just use the analog inputs that give you the correct readings...hehe

mister_e
- 24th November 2007, 02:11
<table><tr><td>http://www.mister-e.org/Pics/CamisoleDeForce</td><td>Yeah there's some stuff like that.
Can you post your whole code?
What happen if you set all other analog input to digital?
Did you try to increase the sampling time?</td></tr></table>

cheezy1963
- 24th November 2007, 05:13
You know. I didn't try setting all the other unused inputs to digital. I will give that a try. I have changed the sampling without any changes.

I did have some success just a bit ago but putting a 200 ohm resistor from AN0/pin 17 to ground.

mackrackit
- 24th November 2007, 05:40
Hi,

I have no idea why the different pins are giving different readings but the way to have these LMs give a stable reading is to place a capacitor from the signal pin to ground. I use a 22uf.

Acetronics2
- 24th November 2007, 08:34
Hi,

The LM 35 problem ...

Simply the output range : 0v for 0°C ...250 mV for 25°C !!!

IF you use the 5v ref voltage ... 250 mV/ 5v = 1/50 of the usable range ...


3 Solutions ...

1) use a Vref just a bit Higher than your max input ( say 500 mv for 50°C ) - not so good !
2) use a voltage amplifier that will allow 5v output for your max input temp.
3) use a LM 335 that offers a 2.73 offset voltage @ 0°C

The more you input on Analog inputs, the less parasitic signals you see ...

Now, the LM 35 has a +/- 1.0 to 1.5 °C Guaranteed max error ..., add the A/D and calculation errors ( PbP works with INTEGERS !!! ) and your couple of degrees is here !!!

as an eyeblick ... how precise is your temp ref ???? ... LOL !!! remember getting the true degree is not so easy ..., and getting the true 1/10 of degree is a really a performance.

Back to the Input problem itself ... What about the comparators settings ???

Alain ... Thermics engineer ...

cheezy1963
- 24th November 2007, 15:14
thanks for the input. I will try the 22uf cap and adding an op amp. Also, the LM335 seems like the best solution.

I agree, getting the accuracy will be a problem but that is not what I'm concerned about. Getting the same reading across different analog inputs is what makes me wonder.

cheezy1963
- 29th November 2007, 00:46
This problem turned out to be capacitive coupling as I did not have the same problem once I built a circuit board. There is enough capacitance in my bread board to couple the signal from the clock source to the analog input.