Download M68HC05 Applications Guide

Transcript
Freescale Semiconductor, Inc.
Applications
Listing — Thermostat Example
Sheet 13 of 21
Freescale Semiconductor, Inc...
**************************************************************
* HVAC — Update Fan, Heat, and Cool outputs
*
*
Low-true outputs will be buffered to drive 24VAC
*
*
relay coils in HVAC equipment.(high true in final) *
*
Heat and Cool requests should not permit short*
*
cycle (ie a min delay is required between changes) *
*
Once Heat or Cool requested, do not turn off for
*
*
at least 30 sec. Also enforce 30 sec. minimum
*
*
off time to restart.
*
*
Allow ± 1° around target temp as hysteresis.
*
* HVACM = 0 — Off, 1 — Heat, 2 — Cool, 3 — Fan Only
*
**************************************************************
0334
0334
0336
0338
033a
033c
033e
0340
0342
0344
0346
0348
034a
034c
034e
0350
b6
27
al
26
b6
26
b6
aa
b7
20
a1
26
1a
b6
0c
0353
0354
0356
0358
035a
035c
035e
4c
b1
24
Ic
le
3f
20
0360
0361
0363
0365
0367
0369
036b
036d
036f
0371
0373
0375
0377
0379
037b
037d
037f
4a
bl
23
lf
ld
a6
b7
20
a1
27
1f
1c
la
20
lc
b6
0a
HVAC
EQU
Update Fan, Heat, and Cool outputs
a3
LDA
SEC
Exit unless sec = 0 or 30
04
BEQ
DOHVAC
0 so do HVAC
le
CMP
#30
60
BNE
XHVAC
Exit if not 0 or 30
aa
DOHVAC
LDA
HVACM
0-off, 1-heat, 2-cool, 3-fan
08
BNE
HM1Q
If not 0 go see if 1
02
LDA
PORTC
Fan*,Heat*,Cool*,Beep;ADen*,E,RS,R/W
e0
ORA
#$EO
Set fan, heat, cool all high (off)
02
STA
PORTC
Update port
54
BRA
XHVAC
& Exit
01
HM1Q
CMP
#1
Check for mode 1-heat
23
BNE
HM2Q
If not go see if 2
02
BSET
5rPORTC Turn off cool output
ab
LDA
GOAL
Get target temp
02 0d
BRSET
6,PORTC,HONQ If not; see if it should be
* Heat on; turn off when indoor temp > goal + 1
INCA
Goal + 1 for hysteresis
ac
CMP
INTMP
GOAL + 1 < INTMP ? Turn off ?
44
BHS
XHVAC
NO; just leave
02
BSET
6,PORTC Turn off heat
02
BSET
7,PORTC Turn off fan
b2
CLR
HVACON
Turn off flag to indicate off
3c
BRA
XHVAC
Then leave
* Heat off; turn on when indoor temp < goal-1
HONQ
DECA
Goal-1 for hysteresis
ac
CMP
INTMP
GOAL-1 > INTMP ? Turn on ?
37
BLS
XHVAC
NO; just leave
02
BCLR
7,PORTC Turn on fan
02
BCLR
6,PORTC Turn on heat
01
LDA
#1
b2
STA
HVACON
Set flag to indicate on
2d
BRA
XHVAC
Then leave
02
HM2Q
CMP
#2
Check for mode 2-cool
08
BEQ
HCOOL
Branch if cool mode 2
02
BCLR
7,PORTC Turn on fan
02
BSET
6,PORTC Turn off heat
02
BSET
5,PORTC Turn off cool
21
BRA
XHVAC
Then leave
02
HCOOL
BSET
6,PORTC Turn off heat output
ab
LDA
GOAL
Get target temp
02 0d
BRSET
5,PORTC,CONQ If not; see if it should be
M68HC05 Applications Guide — Rev. 4.0
224
Applications
For More Information On This Product,
Go to: www.freescale.com
MOTOROLA