-
1 Attachment(s)
LM135 voltage ref
Hi everyone,
I'm trying to study a pic based thermometer using LM135 and PIC16F876A, but the display value is jumping from high to low, I think it has something to do with the voltage reference but I'm not really sure how it must be done. Please check my schematic and codes that I'm using.
*************************************
CLEAR
DEFINE ADC_BITS 8
DEFINE ADC_CLOCK 3
DEFINE ADC_SAMPLEUS 50
TRISA = %11111111
ADCON1 = %00000011 ' Set PORTA.0,1,2,5 = A/D, PortA.3 = +Vref
samples VAR WORD ' Multiple A/D sample accumulator
sample VAR byte ' Holds number of samples to take
temp VAR byte ' Temperature storage
samples = 0 ' Clear samples accumulator on power-up
LOOP:
FOR sample = 1 TO 20 ' Take 20 samples
ADCIN 0, temp ' Read channel 0 into temp variable
samples = samples + temp ' Accumulate 20 samples
PAUSE 250
NEXT sample
temp = samples/20
Serout PortC.1, 6, [$FE, 1, #temp]
samples = 0
GOTO loop
END
*************************************
Thanks in advance,
joe
-
Try a capacitor between the signal pin of LM and ground. 22uF?
-
Hi,
Let's see
Ambient temp is ~ 300°K LM 135 outputs 3v
ADC Counts = 3/5*256 = 153 ... that's OK
mmmmmmh, what about connecting AN3 input to Vss ... and making it an input (!)
or MUCH BETTER correcting your ADCON1 settings ...
cause , for now, you do not have any Vref at all ...
AND you've forgotten to connect the second GND ( or VSS ) PIN !!!
Alain