0% found this document useful (0 votes)
98 views20 pages

Mup Project

This document describes the hardware and software design of a microwave oven controlled by a microprocessor. The system operates in either a quick start or normal start mode. In quick start mode, the default power and time are used, while in normal mode the user can set the power level and cooking time. Timers are used to control the microwave heating element and generate interrupts to track time. Input and output devices are interfaced using programmable peripheral interface chips to read buttons, display time remaining, and control the microwave and buzzer.

Uploaded by

Muskan Bhargava
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
98 views20 pages

Mup Project

This document describes the hardware and software design of a microwave oven controlled by a microprocessor. The system operates in either a quick start or normal start mode. In quick start mode, the default power and time are used, while in normal mode the user can set the power level and cooking time. Timers are used to control the microwave heating element and generate interrupts to track time. Input and output devices are interfaced using programmable peripheral interface chips to read buttons, display time remaining, and control the microwave and buzzer.

Uploaded by

Muskan Bhargava
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 20

Problem no: 11 Batch No: 41

Microprocessor Programming and


Interfacing
Design assignment

Microwave Oven

By

Abhishek Verma 2006A7PS078


Akshay Sathe 2007A7PS082
Dushyant Arora 2006A7PS083

An assignment submitted in
Partial fulfillment of the requirement of the course
ES C263: MICROPROCESSOR PROGRAMMING
AND
INTERFACING

BIRLA INSTITUTE OF TECHNOLOGY AND


SCIENCE
PILANI, RAJASTHAN-333031
17th April, 2008
Problem Statement:

System to be designed: Microwave oven

Description: A simple microwave oven without grill

 User can cook at 5 different power levels: 100%,80%,60%,40%,20%.


 Every press of the power button decrements the power level by 20%
 1 press-100% ; 2 presses -80%; 3 presses-60%; 4 presses-40%; 5presses-20%
 6 presses- brings the power level back to 100%
 The default power level is 100%
 Power level is varied by controlling the amount of time for which the
microwave is turned on.
 Time of cooking is broken up into 10 sec slots ,if power is 60% then for 6 secs
the microwave is on and rest of the 4 secs the microwave is off
 Time is set as multiples of 10 min, 1 min, 10 sec.
 Once power has been set power cannot be modified
 When user is setting power level or time, the value being pressed should be
displayed and when user presses the start button, the cooking process begins
and time left for cooking is displayed.
 Once cooking begins the door gets locked and should open only when cooking
process is terminated.
 User can terminate cooking anytime by pressing STOP button.
 When stop button is pressed once cooking is aborted, timer is stopped, not
cleared cooking can resume by pressing start.
 When stop is pressed twice, cooking is aborted and timer is also cleared.
 When cooking time elapses, a buzzer is sounded; pressing the stop button
stops the buzzer.
 A quick start mode is available where timer or power need not be set, just start
button needs to be pressed, the default power value is taken and time is set as
30 sec, for ever press of the start button time is incremented by 30 seconds.
Assumptions:
1) A jump statement to the start of the code is already given in memory location
FFFF0h of ROM.

2) The CS: IP values corresponding to the interrupts INT 127 and INT 191 are stored
in addresses 001FCh and 002FCh respectively.

3) There is mechanism already in place whereby door will get unlocked if pc1 of
8255A is high and locked if pc1 is low.

4) The heating element of microwave oven is already available.

5) The time required for loading the latched values into counters of 8253 after giving
the gate trigger has been taken as negligible in comparison to total time.

6) Source of clock frequency of 3 KHz is available.

7) Maximum time for cooking user can set is 9999 seconds.

8) User cannot operate in quick start mode if he is working in normal start mode and
vice versa.

System Description:

The system operates in 2 modes: QUICK START mode and NORMAL START
mode. In quick start mode system takes default value of power i.e. 100% and time as
30 sec. For every press of start button time is incremented by 30 sec. Timers are set
and countdown begins and the time left for cooking is shown on seven segment
display. The user can terminate cooking anytime by pressing STOP button which
resumes on pressing START button. Cooking is aborted by pressing stop button
twice.

In normal start mode user can set desired value of power and time. Time of
cooking is broken up into ten seconds slots. For e.g. -- If power is 80% then for 8
seconds the microwave oven is on and for the remaining two seconds it is off.
When cooking time elapses buzzer is sounded. When the user presses the STOP
button the buzzer stops.
Hardware Description:

CHIP CHIP USE


NUMBER
(no. of chips)

8086 MICROPROCESSOR CENTRAL PROCESSING


UNIT
4016(2) RAM-2K RANDOM ACCESS
MEMORY WHICH
CONTAINS DS,SS
2716(2) ROM-2K READ ONLY MEMORY
WHICH CONTAINS THE
CODE AND INTERRUPT
VECTOR TABLE
74LS373(3) 8-BIT LATCH TO LATCH ADDRESS-BUS

74LS245(2) 8-BIT BUFFER TO BUFFER DATA BUS


(BIDIRECTIONAL)
74LS244(2) 8-BIT BUFFER UNIDIRECTIONAL BUFFER
8255(2) PROGRAMMABLE CONNECTED TO VARIOUS
PERIPHERAL INPUT OUTPUT DEVICES
INTERFACE
555(2) CLOCK TO GENERATE THE CLOCK
GENERATOR PULSE FOR ALL 3 CLOCKS
OF 8253A
8253(2) CLOCK TIMER TO PRODUCE THE STABLE
FREQUECY CLOCK SIGNAL
WHICH STEPS THE 8086
EXECUTION OF IT’S
INSTRUCTIONS IN AN
ORDERLY MANNER
8284A(1) CLOCK IT GENERATES A CLOCK
GENERATOR PULSE OF 5MHz FOR THE
8086
7447(4) BINARY TO TO DISPLAY THE TIME
DIGITAL LEFT ON 4 7-SEGMENT
CONVETROR DISPLAYS
Some other hardware:
In addition to the above mentioned hardware, the following components have also
been used:

1) Logic Gates and Diodes:


These are primarily used in the decoding logic for memory and input/output
interfacing

2) Resistors:
Resistors are used to control voltages and currents at various parts of the system.

3) 7-segment displays:
Seven segment displays are used to display the user entered values.4 segment displays
are used to display the four digits of the time remaining/ power/ time set.

4) Relay:
It is used to connect the heating-element of the microwave oven with the out pin of
the timer C0 of 8253A.

5) Buzzer:
The buzzer is set on after the cooking time elapses and is connected via an n-p-n
transistor to out-pin of C0 of 8253B.

6) Push Buttons:
They are used to input the power, time, start and stop signals from the user.

DEVICE-TO-PORT INTERFACING SPECIFICATIONS:

8255-A

PORT PORT MODE INPUT/OUTPUT CONNECT TO


ADDRESS

A 80H 0 INPUT TIME FROM OVEN

B 82H 0 INPUT START, STOP AND


POWER FROM
OVEN

C 84H 0 OUTPUT -----------


(UPPER)
START PORT FOR
C 84H 0 OUTPUT 555 TRIGGER AND
(LOWER) GATES OF C0, C1
AND C2 OF 8253A,
DOOR LOCK,
RESET OF 555.
8255-B

PORT PORT MODE INPUT/OUTPUT CONNECT


ADDRESS TO

A 20H 0 OUTPUT TWO 7447s

B 22H 0 OUTPUT TWO 7447s

C 24H 0 ----------- -------------


(UPPER)

C 24H 0 ------------ -------------


(LOWER)

The input and output devices of the system are connected using 8255
Programmable peripheral Interfacing controllers. Here we connect the A0 and A1 of
8255 to the A1 and A2 of the 8086 address bus respectively.

8253 A

COUNTER ADDRESS MODE CONNECTED TO

COUNTER0 60H 1 TO MICROWAVE


HEATING ELEMENT
THROUGH A RELAY

COUNTER1 62H 2 TO THE GATE OF


COUNTER 0 OF 8253 A

COUNTER2 64H 1 TO THE GATE OF


COUNTER 0 OF 8253 B
8253 B

COUNTER ADDRESS MODE CONNECTED TO

TO THE BUZZER
COUNTER0 40H 3 (SPEAKER)

COUNTER1 42H ----- ---------

COUNTER2 44H ----- -------

A programmable timer (8253) is also interfaced to the processor independent


of other IO devices or PPIs starting at addresses 60h and 40h. Similar to the 8255
interfacing, we connect the A0 and A1 of 8253 to the A1 and A2 of the 8086 address
bus respectively.

MEMORY ADDRESSES:

DEVICE A19 A18 A17 A16 A15 A14 A13 A12 A11 A10 A9 A8 A7 A6 A5 A4 A3 A2 A1 A0
4016 SRAM
From 01000h 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0
To 01FFFh 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1
2716 ROM
From 00000h 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
To 00FFFh 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1

The system uses 4KB of RAM and 4KB of ROM. Both consist of two chips of
2KB size each. They are organized into odd and even bank to facilitate both byte and
word size data transfers. Code starts at address 00400h.
FOLD BACK ADDRESSING IS BEING USED FOR ROM. FF000h-FFFFFh ARE
THE ADDRESSES FOLDED BACK ONTO 00000h-00FFFh.
Software Algorithm:

1. The timer modes of 8253A and 8253B are set to appropriate values.

2. The control registers of 8255A and 8255B are also set.

3. The counter values in the counter modes are set corresponding to quick start
mode
.
4. If the user presses start or stop button the corresponding interrupts INT 191
and INT 127 respectively are invoked.

5. If the user presses start button at this juncture microwave start operating in
quick start mode. The gates of all the counters and the trigger pin of 555 timer
are triggered and also the door is locked.

6. Else user can set desired values of power and time for cooking and then press
the start button. Once time has been set power cannot be modified.

7. For every press of start button during quick start mode countdown timer gets
incremented by 30.

8. While user is setting the power values or time the value being pressed should
be displayed on seven segment display simultaneously.

9. Say the user has set power value 60%, then C0 is set as 6 and C1 as 10. Each
clock corresponds to 0.1 second. The out-pin of C0 remains high for 0.6
seconds then becomes low for 0.4 seconds. Meanwhile C1 remains low for 1
second and gives trigger to C0 after 1 sec so that countdown starts again. The
output pin is connected to heating element of microwave oven.

10. The total count is stored in C2. The C2 value is latched and read after every
one second and displayed on seven segment display.

11. When C2 counter value reaches 0 it triggers c1 counter of 8253B which then
generates the square wave which is connected to the buzzer. The buzzer can
be stopped by pressing the stop button which unlocks the door and the
program restarts.

12. When the user presses stop-button the clock inputs to the timers are removed
and the door is unlocked.

13. For two consecutives stops, the cooking is aborted, door is unlocked and the
program restarts.
ALP USED FOR THE SYSTEM:
; Data in RAM

POWER DB 10
TIME DW 0
QFLAG DB 0
SFLAG DB 0
TRIG DB 0
COUNT DW 0

; Code in ROM

STI ; TO ENABLE THE IE FLAG AFTER RESET.

STPRO:
MOV SFLAG,0

MOV AL,13H
OUT 66H,AL
MOV AL,55H
OUT 66H,AL ; SETTING TIMER MODES
MOV AL,0B3H
OUT 66H,AL
MOV AL,17H
OUT 46H,AL

MOV AL,80H
OUT 26H,AL ; CR OF 8255B

MOV AL,92H
OUT 86H,AL ;CR OF 8255A

MOV AL,10H
OUT 60H,AL
MOV AL,10H
OUT 62H,AL
MOV AL,0
OUT 64H,AL
OUT 64H,AL
MOV AL,10
OUT 40H,AL ;SET COUNTER VALUE ,SET C1=10,C0=10 AND C2=0 AND
8253B C0=10

X3:IN AL,82H
AND AL,20H
CMP AL,20H
JNZ X1 ; CHECKING FOR POWER
JMP X3
X1:
JUMP DELAY1

X4:IN AL,82H
AND AL,20H
CMP AL,0
JZ X4 ; WAITING FOR KEY RELEASE

JUMP DELAY1

JUMP PDISP

A3:JUMP PDISP
IN AL,82H
AND AL,20H
CMP AL,20H
JNZ A1 ;TIMER AND POWER INPUT
IN AL,80H
AND AL,0E0H
CMP AL,0E0H
JNZ A2
JMP A3

A1:

JUMP DELAY1

KO:IN AL,82H
AND AL,20H
CMP AL,0
JZ KO

JUMP DELAY1

SUB BYTE PTR POWER,2

CMP BYTE PTR POWER,0

JNZ A3

MOV BYTE PTR POWER,10

JMP A3

A2:
JUMP DELAY1

IN AL,80H
CMP AL,60H
JNZ R1
ADD WORD PTR TIME,600

R1:
CMP AL,0A0H
JNZ R2:
ADD WORD PTR TIME,60

R2:
ADD WORD PTR TIME,10

HO:IN AL,80H
AND AL,0E0H
CMP AL,0E0H ; KEY RELEASE WAIT
JNZ HO

JUMP DELAY1 ; KEY DEBOUNCE

JUMP TDISP

CMP BYTE PTR POWER,10


JNZ WES
MOV AL,10H
OUT 60H,AL
JMP RED
WES:MOV AL,POWER
OUT 60H,AL ; SET 8253A C0 ACCORDING TO POWER

RED:

PO:IN AL,80H
AND AL,0E0H
CMP AL,0E0H ;CHECKING FOR TIMER
JNZ K1
JMP PO

K1:

JUMP DELAY1

IN AL,80H
CMP AL,60H
JNZ R1
ADD WORD PTR TIME,600
R1:
CMP AL,0A0H ;TIMER INPUT
JNZ R2:
ADD WORD PTR TIME,60

R2:
ADD WORD PTR TIME,10

HOL:IN AL,80H
AND AL,0E0H
CMP AL,0E0H ;WAITING FOR KEY RELEASE
JNZ HOL

JUMP DELAY1

JUMP TDISP

RED:MOV DX,0
MOV AX,TIME
MOV BX,1000
DIV BX
MOV DI,AX
MOV CL,12
SHL DI,CL
MUL BX
MOV SI,TIME
SUB SI,AX
MOV AX,SI
MOV BL,100 ; THIS BLOCK CONVERTS BIN TO BCD
DIV BL
MOV BX,DI
ADD BH,AL
MOV DI,BX
MOV BL,100
MUL BL
SUB SI,AX
MOV AX,SI
MOV BL,10
DIV BL
MOV BX,DI
ADD BL,AL
MOV CL,4
SHL BL,CL
MOV DI,BX
MOV BL,10
MUL BL
SUB SI,AX
ADD DI,SI
MOV BX,DI
MOV AL,BL
OUT 64H,AL
MOV AL,BH
OUT 64H,AL ; SET 8253A C2=TIMER

JMP PO

NIO:

MOV AL,80H
OUT 66H,AL
IN AL,64H
MOV BL,AL ;LATCHING AND READING C2 OF 8253A
IN AL,64H
MOV BH,AL

CMP BX,0
JNZ GOAT ;CHECKING IF BUZZER HAS BEEN STOPPED
CMP SFLAG,1
JNZ GOAT
MOV SFLAG,0

MOV AL,03H
OUT 86H,AL ;DOOR UNLOCK

JMP STPRO

GOAT:OUT 20H,BH
OUT 22H,BH ;COUNTDOWN DISPLAY

MOV CX,46729
E1:NOP
NOP
MOV CX,4
E2:NOP ; DELAY OF 1s approx.
NOP
LOOP E2
LOOP E1

JMP NIO
end

.ORG 00900h

DELAY1:
MOV CX,4348
DELP:NOP
NOP ; DELAY OF 20ms approx.
LOOP DELP
RET

.ORG 00800h
PDISP:
CMP BYTE PTR POWER,10
JZ ETW
MOV BL,POWER
MOV CL,4
SHL BL,CL
MOV AL,0
OUT 20H,AL
MOV AL,BL
OUT 22H,AL
JMP EFG

ETW:
MOV AL,1
OUT 20H,AL
MOV AL,0
OUT 22H,AL

EFG:RET

.ORG 00880h
TDISP:

MOV DX,0
MOV AX,TIME
MOV BX,1000
DIV BX
MOV DI,AX
MOV CL,12
SHL DI,CL
MUL BX
MOV SI,TIME
SUB SI,AX
MOV AX,SI
MOV BL,100 ; THIS BLOCK CONVERTS BIN TO BCD
DIV BL
MOV BX,DI
ADD BH,AL
MOV DI,BX
MOV BL,100
MUL BL
SUB SI,AX
MOV AX,SI
MOV BL,10
DIV BL
MOV BX,DI
ADD BL,AL
MOV CL,4
SHL BL,CL
MOV DI,BX
MOV BL,10
MUL BL
SUB SI,AX
ADD DI,SI

MOV BX,DI
MOV AL,BH
OUT 20H,AL ; DISPLAY TIME REMAINING
MOV AL,BL
OUT 22H,AL

RET

ISR START

JUMP DELAY1

JOY:IN AL,82H
AND AL,80H
CMP AL,0 ;KEY RELEASE WAIT
JZ JOY

JUMP DELAY1

MOV AL,80H
OUT 66H,AL
IN AL,64H
MOV BL,AL ; LATCH C2
IN AL,64H
MOV BH,AL

CMP BX,0
JZ PCO
CMP BYTE PTR QFLAG,1
JZ PCO

CMP BYTE PTR TRIG,0


JNZ ROE

MOV BYTE PTR TRIG,1

MOV AL,06H
OUT 86H,AL
MOV CX,3
SE:NOP ;TRIGGER TO 555
LOOP SE

MOV AL,07H
OUT 86H,AL

MOV CX,3
SE:NOP
LOOP SE

MOV AL,06H
OUT 86H,AL

MOV AL,04H
OUT 86H,AL

MOV CX,3
SE:NOP ;TRIGGER TO TIMER GATES
LOOP SE

MOV AL,05H ;ALWAYS HIGH


OUT 86H,AL

JMP BLUE

ROE:
MOV AL,06H
OUT 86H,AL

MOV CX,3
SE:NOP ;TRIGGER TO 555
LOOP SE

MOV AL,07H
OUT 86H,AL

MOV CX,3
SE:NOP
LOOP SE

MOV AL,06H
OUT 86H,AL

BLUE:
MOV BYTE PTR SFLAG,0
MOV AL,02H
OUT 86H,AL ;DOOR LOCK

JMP NIO ;NOW RETURN BACK TO 7-SEGMENT DISPLAY

PCO:
MOV BYTE PTR QFLAG,1

CMP BYTE PTR SFLAG,0


JNZ J1

MOV AL,80H
OUT 66H,AL
IN AL,64H
MOV BL,AL ; BX NOW CONTAINS LATCH C2
IN AL,64H
MOV BH,AL

MOV CX,00
MOV CL,BL
AND CL,0FH
ADD COUNT, CX
MOV CL,BL
AND CL,0F0H
MOV DL,CL
MOV CL,04H
ROR DL,CL
MOV CL,DL
MOV AL,0AH
MUL CL
MOV CL,AL
ADD COUNT,CX
MOV CL,BH ;ADD 30 TO C2(BX)
AND CL,0FH
MOV AL,100
MUL CL
MOV CX,AX
ADD COUNT, CX
MOV CX,00
MOV CL,BH
AND CL,0F0H
MOV DL,CL
MOV CL,04H
ROR DL,CL
MOV CL,DL
MOV AX,1000
MUL CX
MOV CX,AX
ADD COUNT,CX
ADD COUNT,30

MOV DX,0
MOV AX,COUNT
MOV BX,1000
DIV BX
MOV DI,AX
MOV CL,12
SHL DI,CL
MUL BX
MOV SI,COUNT
SUB SI,AX
MOV AX,SI
MOV BL,100
DIV BL
MOV BX,DI
ADD BH,AL
MOV DI,BX ;CONVERT COUNT TO BCD STORE IN BX
MOV BL,100
MUL BL
SUB SI,AX
MOV AX,SI
MOV BL,10
DIV BL
MOV BX,DI
ADD BL,AL
MOV CL,4
SHL BL,CL
MOV DI,BX
MOV BL,10
MUL BL
SUB SI,AX
ADD DI,SI

MOV BX,DI
MOV AL,BL ; MOVE BX TO C2 (C2 INCREMENTED BY 30)
OUT 64H,AL
MOV AL,BH
OUT 64H,AL

CMP BYTE PTR TRIG,0


JNZ COOL

MOV BYTE PTR TRIG,1

MOV AL,06H
OUT 86H,AL
MOV CX,3
SE:NOP ;TRIGGER TO 555
LOOP SE

MOV AL,07H
OUT 86H,AL

MOV CX,3
SE:NOP
LOOP SE

MOV AL,06H
OUT 86H,AL

MOV AL,04H
OUT 86H,AL

MOV CX,3
SE:NOP ;TRIGGER TO TIMER GATES
LOOP SE

MOV AL,05H ;ALWAYS HIGH


OUT 86H,AL

COOL:
MOV AL,02H
OUT 86H,AL ;DOOR LOCK

JMP NIO ;NOW RETURN BACK TO 7-SEGMENT DISPLAY

J1:

MOV AL,02H
OUT 86H,AL ;DOOR LOCK

MOV AL,06H
OUT 86H,AL

MOV CX,3
SE:NOP ;TRIGGER TO 555
LOOP SE

MOV AL,07H
OUT 86H,AL

MOV CX,3
SE:NOP
LOOP SE
MOV AL,06H
OUT 86H,AL

MOV BYTE PTR SFLAG,0

JMP NIO ;NOW RETURN BACK TO 7-SEGMENT DISPLAY

ISR STOP
JUMP DELAY1

TOY:IN AL,82H
AND AL,40H
CMP AL,0 ;KEY RELEASE WAIT
JZ TOY

JUMP DELAY1

CMP BYTE PTR SFLAG,0


JZ VOX

MOV AL,03H
OUT 86H,AL ;DOOR UNLOCK

MOV BYTE PTR SFLAG,1

JMP STPRO

VOX:
MOV AL,01H
OUT 86H,AL

MOV CX,3
SE:NOP ;RESET TO 555(WAIT OF APPROX 10uS)
LOOP SE

MOV AL,00H
OUT 86H,AL

MOV BYTE PTR SFLAG,1


MOV AL,03H
OUT 86H,AL ;DOOR UNLOCK

JMP NIO ;NOW RETURN BACK TO 7-SEGMENT DISPLAY

---- END OF THE CODE ----

You might also like