MrDEB
Well-Known Member
using this code from Pommie, I am curious as to how accurate the temperature is?
I placed a potted temp sensor in ice water and could only get down to 1.5C
should it not be )c?
perhaps I need to freeze the probe in ice? for )c
Then need to ACCURATLY convert to Farienheight.
(9*Tc)/5+32
I have this but it says my temperature is 21.5celius or 145degrees farienght (Am not real good at math so I know in the code I did the conversion wrong.
My goal is to use an LCD display that displays the temperature of 3 different coolers (food, walk-in and a beer cooler walk-in)
Health dept. want 36-40 degrees in the food coolers.
I want 34degrees in the beer cooler
I placed a potted temp sensor in ice water and could only get down to 1.5C
should it not be )c?
perhaps I need to freeze the probe in ice? for )c
Then need to ACCURATLY convert to Farienheight.
(9*Tc)/5+32
I have this but it says my temperature is 21.5celius or 145degrees farienght (Am not real good at math so I know in the code I did the conversion wrong.
My goal is to use an LCD display that displays the temperature of 3 different coolers (food, walk-in and a beer cooler walk-in)
Health dept. want 36-40 degrees in the food coolers.
I want 34degrees in the beer cooler
Code:
DEVICE = 18F1320
CLOCK = 8 // 8MHz clock
CONFIG OSC = INTIO2, WDT = OFF, LVP = OFF
INCLUDE "OW.bas"
INCLUDE "USART.bas"
INCLUDE "DS18B20.bas"
INCLUDE "CONVERT.bas"
INCLUDE "String.bas"
DIM Temperature AS WORD
DIM i AS BYTE
DIM ROM(8) AS BYTE
OSCCON = $72 // select 8MHz internal clock
ADCON1 = $7f //all digital
TRISA.3=0 //A3 output
PORTA.3=1 //and high
SetBaudrate(br9600)
OW.SetPin(PORTA.4)
WHILE true
IF OW.Reset THEN
OW.WriteByte(owReadROM) //Skip ROM
USART.Write("Rom = ")
FOR i = 0 TO 7
ROM(i)=OW.ReadByte()
USART.Write(Right("00"+HexToStr(ROM(i)),2))
NEXT
OW.Reset
OW.WriteByte(owSkipROM) //Skip ROM
OW.WriteByte($44) //Convert
OW.Reset
OW.WaitForHigh //wait for convert to finish
OW.Reset
OW.WriteByte(owSkipROM) //Skip Rom
OW.WriteByte($be) //Read Scratch Pad
Temperature=OW.ReadByte()
Temperature=(Temperature+OW.ReadByte()*256)
IF ROM(0)=$28 THEN
Temperature=Temperature/8
ENDIF
USART.Write(" Temperature = ",DecToStr(Temperature/2))
IF (Temperature AND 1) = 1 THEN
USART.Write(".5")
USART.Write("Celius",13,10)
USART.Write(" Temperature = ",DecToStr(Temperature*9/5+32))
USART.Write("F",13,10)
DELAYMS(2000)
ENDIF
ELSE
USART.Write("No device found", 13, 10)
ENDIF
DELAYMS (100)
WEND
END