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
Bookmarks