Searching \ for '[PIC]: Thermostat Routine?' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: techref.massmind.org/techref/microchip/devices.htm?key=pic
Search entire site for: 'Thermostat Routine?'.

Exact match. Not showing close matches.
PICList Thread
'[PIC]: Thermostat Routine?'
2001\01\05@043348 by Francois Robbertze

flavicon
face
Dear Piclist Members

The routine read the temperature from a Dallas1820 UpperT = 27 deg C (54)
LowerT = 23 deg C (46)
Element is a Triac

As the temperature rises with the Element on it will switch off at 27 deg C which is OK.
As the temperature now decreases the Element should switch on below the LowerT value, but it don't - It switch on at a value below 27 deg again???

Can someone tell me where am I going wrong...

Main
call Thermostat

Thermostat
call ReadTemp         ; Subroutine to read temperature from Dallas1820
movlw 'E'                  ;Test for failure in dallas1820
subwf Temp,W
btfsc STATUS,Z
goto DallasError

movfw Temp
subwf UpperT,W
btfss STATUS,C
call HeatingOff

movfw Temp
subwf LowerT,W
btfsc STATUS,C
call HeatingOn
return
HeatingOn
bsf Element
return

HeatingOff
bcf Element
return

DallasError
bcf Element     ; do no heating and
return              ;return to main loop

(If I am on the wrong track please direct me to a some info pages)

Regards

             lllllllllll
            \\  ~ ~ //
            ( @ @ )
o------oOOo-(_)-oOOo-----o
|                                   |
|   Francois Robbertze    |
|    spam_OUTfr10TakeThisOuTspammweb.co.za     |
|                                   |
o--------.oooO-Oooo.-------o

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email .....listservKILLspamspam@spam@mitvma.mit.edu with SET PICList DIGEST in the body


2001\01\05@054342 by Michael Rigby-Jones

flavicon
face
See comments in code

{Quote hidden}

       ; Subtract the current temperature from UpperT
       ; if current temperature is higher than UpperT, the result
       ; will be negative and Carry will be set
>  btfss STATUS,C
       ; this should be btfsc STATUS,C
>  call HeatingOff
>
>  movfw Temp
>  subwf LowerT,W
       ; Subtract current temperature from LowerT
       ; If current temperature is lower than LowerT, the result
       ; will be positive and Carry will be clear
>  btfsc STATUS,C
       ; this should be btfss STATUS,C
{Quote hidden}

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email EraseMElistservspam_OUTspamTakeThisOuTmitvma.mit.edu with SET PICList DIGEST in the body


2001\01\06@080158 by Peter L. Peres

picon face
Hi Francois,

you forgot about the Hysterezis. You need to store the current state of
the heater and compare with the appropriate limit:

Heater On  -> check HIGH temp
Heater Off -> check LOW temp

In your code that would be like:

Main
bcf     Flags,BHeaterOn ;; heater may not come on without this !!!
call Thermostat

Thermostat
call ReadTemp         ; Subroutine to read temperature from Dallas1820
movlw 'E'                  ;Test for failure in dallas1820
subwf Temp,W
btfsc STATUS,Z
goto DallasError

btfss  Flags,BHeaterOn  ;; switch on heater state
goto   Heater_is_off

movfw Temp
subwf UpperT,W
btfsc STATUS,C       ;; skip if hotter
return               ;; early

call HeatingOff
bcf  Flags,BHeaterOn ;; remember state
return

Heater_is_off
movfw Temp
subwf LowerT,W
btfss STATUS,C       ;; skip if colder
return               ;; early

call HeatingOn
bsf  Flags,BHeaterOn ;; remember state
return

HeatingOn
bsf Element
return

HeatingOff
bcf Element
return

DallasError
bcf Flags,BHeaterOn  ;; this is important for restart
bcf Element     ; do no heating and
return              ;return to main loop

Note that you test for C so the temperature will be between HighT > T > LowT
(not including the limits).

Peter

--
http://www.piclist.com hint: To leave the PICList
piclist-unsubscribe-requestspamspam_OUTmitvma.mit.edu


2001\01\08@040945 by Francois Robbertze

flavicon
face
Thank you Peter, I have implement the code as you suggested, and it is
working fine!!

Regards

Francois


{Original Message removed}

More... (looser matching)
- Last day of these posts
- In 2001 , 2002 only
- Today
- New search...