Microcontroller Simulator Task 3b - Electronics Tutorials |
Heater and Thermostat
Copy and paste the example program into the code editing area. Press F8 to assemble the code. Click the HEATER button on the highlighted "C" to connect the heater to PORTC. Step the program and watch the heater. Answer the reviseOmatic questions on this task. This program should run analtered on the PICAXE 28X1 chip if you are able to interface a heater and a thermostat.
TASK:
MOVW 0X1 ; OOOOOOOI
MOVWR TRISC ; SET PORTC I/O
LOOP:
MOVRW PORTC ; READ HEATER PORT
ANDW 0x1 ; IGNORE BITS 2 TO 7
SUBW 0x1 ; SEE IF W CONTAINED 1
JPZ TOOHOT
JMP TOOCOLD
TOOHOT:
; ===== Add two lines here ==============
; HEATER OFF
; WRITE TO HEATER
JMP LOOP
TOOCOLD:
; ===== Add two lines here ==============
; HEATER ON
; WRITE TO HEATER
JMP LOOP
|