Microcontroller Simulator Task 3b - Electronics Tutorials

Heater and Thermostat

Heater and ThermostatOpen a browser window or tab containing the microcontroller simulator.

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.
If necessary, drag the heater to a more visible position.

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.
Time delays to slow the program down might be needed too.


  • MOVW     0X1
    This line stores a number into W that will be used to set TRISA.
    TRISA controls whether PORTA pins are inputs or outputs.
     
  • MOVWR    TRISC
    This line copies from W into TRISC
     
  • MOVRW    PORTC
    This line READS PORTC. It copies from PORTC into W.
     
  • ANDW    0x1
    This is a bit mask. All the bits apart from bit zero will be masked to zero.
     
  • SUBW    0x1
    If W contains 1, this line will set W to zero and the Z flag will be set.
     
  • JPZ     TOOHOT
    This jump only happens if the Z flag is set. This happens if the temperature is above 22C.
     

TASK:
Add four lines to this program to make the temperature steady at about 22 C.
Convert the flow chart into assembly code commands.
Flow Chart

        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

 

Topics:

01-nop-jmp   02-LEDs   03-Heater   03-Tlight   04-SevSeg   05-Delay   06-H-Bridge   07-Interrupts   08-Gray   09-Stepper   doc   hex-num   index  

Flash:

sim  

PDF:

Microcontroller Simulator  

DOC:

Microcontroller Simulator   Microcontroller Simulator.   Microcontroller with Harvard Architecture  

Images:

architecture   assem-H-Bridge   assem-Heater-FC   assem-Heater   assem-Stepper   assem-TLIGHT-grid   Gray   pinout   sim-leds   sim-sev-seg-design   sim-sev-seg   sim-traffic  

 

Privacy Policy, © Copyright, Contact Information and Disclaimers

Site highly rated by Schoolzone.co.uk

Valid XHTML 1.0 Transitional

Valid CSS!