You are on page 1of 27

SEE 3223 Microprocessor Alarm

System

University Technology Malaysia

MICRO P
SEE 3223
SEMESTER 2 2009/2010

ASSIGNMENT 10
“ALARM SYSTEM”

Section 01

NAME : 1. NGO CHEE WUNG (AE070273)


2. SAM XIN MIN (AE070359)
3. DAMIAN JUDE A. BUNGKONG (AE070061)

LECTURER : MR. KAMAL kHALIL

DATE :1ST APRIL 2010

1
SEE 3223 Microprocessor Alarm
System

Table of Contents

Assignment 10 : Alarm System


page

1: Introduction 3

2: Objectives 4

3: Hardware & Software Requirements 4

4:Statement of Problem 5

5:System Design
5.1: Flow Chart
5.1.1: Interrupt 8
5.1.2.:Exit , Entry and Protective Mode 11
5.2: IDE 68k Alarm System Design 14

6: Corresponding Peripherals in the Program 19

7: Discussions
7.1: Interrupt, Exception ,Trap 21
7.2: IDE 68k Alarm system 22

8: Conclusion 25

9: References 26

10:Soft Copy of Simulation File 27

2
SEE 3223 Microprocessor Alarm
System

1. Introduction

This assignment required students study the requirement on the

alarm system given. Students need to analyze the system requirement

and design the flow chart. Finally, students need to write the program by

using IDE 68k assembler and run the program. Interrupts, exception, trap,

subroutine ,counter and branch were used to complete the assembler

language. The output was tested by using the hardware of visual simulator

such as switch, LED and seven segment display. Finally students try to

implement the program using Flight 68k.

3
SEE 3223 Microprocessor Alarm
System

2. Objectives

2.1 To analyze the requirements of a home alarm system.

2.2 To design the alarm system by using IDE68k.

2.3 To determine the output of the system by using visual

simulator.

2.4 To implement the design in Flight 68k in lab.

3. Hardware & Software Requirements

a) A PC running the Windows NT, 2000,XP,Vista or seven


operating systems.
b) IDE 68K, 68k Visual Simulator, Flight 68k.

4
SEE 3223 Microprocessor Alarm
System

4. Statement of Problem

In this assignment you will be using the 68000 IDE Version 2.11 and the
Visual Simulator Version 1.40. You will build 68000 program, cross-assemble
and assemble it using the 68000 IDE. You will run the program using the Visual
Simulator. The program will use the Peripheral simulator built in the Visual
Simulator for its Input/Output interface.

Base on the examples in switch.asm and VOLTMTR.asm, design and build a


program which performs the function of a HOME alarm system. The following are
the function of the IRQ buttons and switches panel, message denoted by LED’ s
panel, and requirements of the alarm system.

Function of each IRQ button.


Button IRQ# Function
I1 1
I2 2
I3 3
I4 4
I5 5 Enter push button switch to read Password from Switches panel
I6 6 Arm Alarm push button switch
I7 7 Disarm Alarm
Message denoted by LED

Bit Function
#
0 SECTOR1_LED
1 SECTOR2_LED
2 SECTOR3_LED
3 SECTOR4_LED
4 Siren On (SIREN_ON)
5 Counting Down done (COUNT_ZERO)
6 Alarm Armed (ARMED_LED)
7 Alarm Disarmed (DISARMED_LED)

5
SEE 3223 Microprocessor Alarm
System

Function of each bit of the Switches panel

Bit Function
#
0 Main door opened (MAINDOOR)
1 Sensors at sector 1 (SECTOR1_SENSOR)
2 Sensors at sector 2 (SECTOR2_SENSOR)
3 Sensors at sector 3 (SECTOR3_SENSOR)
4 Sensors at sector 4 (SECTOR4_SENSOR)
5 Password bit #0
6 Password bit #1
7 Password bit #2

Requirements:

If alarm is DISARMED the system will do nothing while waiting for an Arm
alarm signal.
When the Alarm is ARMED and it will go into EXITENTRYDOOR mode
first before entering PROTECTIVE mode. In the EXITDOOR mode seven the
segment panel begins counting down from ten to zero in lapse of
approximately 1 second per count. In this mode the ARMED_LED will flicker.
When the count reach zero the alarm will go into PROTECTIVE mode.
In PROTECTIVE mode, if the main door is opened the alarm will go into
ENTRY mode. In the ENTRY mode seven the segment panel begins counting
down from ten to zero in lapse of approximately 2 second per count. In this
mode the DISARMED_LED will flicker. In this mode, unless the correct
PASSWORD is entered before the count is zero; the siren will be switch ON.
The password is entered by setting the switch panel then followed by
pressing the I5 button
Anytime in the PROTECTION mode, if any of the sectors’sensors are
activated, the siren will be switched ON.
Assuming a condition that the owner has not exit the main door (say just
woke up or accidentally trigger an ALARM), anytime in the PROTECTION
mode, if a PASSWORD entry is entered and correct, the alarm will be
DISARMED and the siren will be switched OFF (regardless of its current
state).
When siren is ON, the alarm disarm button will not disarm the alarm
unless a correct 8-bit password has been entered from the switch panel,

6
SEE 3223 Microprocessor Alarm
System

Suggested Pseudo Code Solution


Main Program
Begin
Initialise Interrupt vector table to service IRQ5 with IRQ5 Interrupt Service Routine
Initialise Interrupt vector table to service IRQ6 with IRQ6 Interrupt Service Routine
Initialise Interrupt vector table to service IRQ7 with IRQ7 Interrupt Service Routine
ALARM_ARM Flag  0 ;DISARM mode

Do :wait for (ALARM_ARM flag = 1) {ARMED mode) from I1 interrupt SR -


Toggle DISARMED_LED bit
Wait 1 second
While (ALARM_ARM flag <> 1)

STANDBY bit  0
COUNTDOWN  10

Do ; ARMED:EXITDOOR mode
COUNTDOWN  COUNTDOWN-1
Toggle ARMED_LED bit
Wait 1 second
While (COUNTDOWN <> 0)

COUNT_ZERO  1
Repeat
If (ALARM_ARM flag= 1)
If (MAINDOOR = ON)
Siren Bit  1
Else
ALARM_ARM  2 ;PROTECTION mode
ARMED_LED  1
DISARMED_LED  0
Endif
Endif
If (ALARM_ARM flag= 2) ;PROTECTION mode
IF (PASSWORD_CORRECT flag = 1) ;Password correct
ALARM_ARM flag 0
Siren LED 0 ;OFF siren
End if
Endif
If (SIREN_ON = 1)
IF (PASSWORD_CORRECT flag = 1) ;Password correct
Siren LED 0 ;OFF siren
ARMED_LED  0 ;
DISARMED_LED  1
End if
Elseif (ALARM_ARM flag = 2) ;If ARMED:PROTECTION mode
If (MAINDOOR = ON) ;
COUNTDOWN  10

7
SEE 3223 Microprocessor Alarm
System

Do :wait for password entry from I5 ISR ARMED:ENTRY mode


COUNTDOWN  COUNTDOWN-1
Toggle ARMED_LED bit
Wait 2 second
While (COUNTDOWN <> 0)

IF (PASSWORD_CORRECT flag = 0) ;Password incorrect


Siren LED  1 ;ON siren
Else
ARMED_LED  1
DISARMED_LED  0
Endif
Endif
IF (SECTOR1_SENSOR=1)
SECTOR1_LED  1
SIREN_ON  1
Endif
IF (SECTOR1_SENSOR=2)
SECTOR2_LED  1
SIREN_ON  1
Endif
IF (SECTOR1_SENSOR=3)
SECTOR3_LED  1
SIREN_ON  1
Endif
IF (SECTOR1_SENSOR=4)
SECTOR4_LED  1
SIREN_ON  1
Endif
Endif

Forever
End

IRQ5 Interrupt Service Routine


Begin
If (Switch panel = password)
PASSWORD_CORRECT flag  0
Endif

Return from interrupt


End
IRQ6 Interrupt Service Routine
Begin
ALARM_ARM flag  1
Return from interrupt
End
IRQ7 Interrupt Service Routine
Begin
If (PASSWORD_CORRECT flag = 1)
ALARM_ARM flag  0
Endif
Return from interrupt
End

8
SEE 3223 Microprocessor Alarm
System

5. System Design

5.1 Flow chart

5.1.1: Flow chart for interrupt

Interrupt 4 Interrupt 5

INT 4 INT 5
INTERRUPT 4 INTERRUPT 5

DISPLAY GROUP STORED SWITCH


MEMBERS’NAME TO D0

EXCEPTION
“DEVIDE BY ZERO” PASSWORD = 11110000
D0-11110000

NO
TRAP #15 PASSWORD ARMED LED = 1
INCORRECT DISARMED LED = 0
DO =0? SIREN LED =1
SOUND =1
YES
PASSWORD
CORRECTCO

ARMED LED = 0
DISARMED LED = 1
SIREN LED =0
SOUND =0

9
SEE 3223 Microprocessor Alarm
System

Interrupt 6 Interrupt 7

INT 6 INT 7
INTERRUPT 6 INTERRUPT 7

SYSTEM ARMED
OR EXIT MODE
SYSTEM DISARMED
(Correct password must
key in. Otherwise, alarm
will be triggered. )
ARMED LED =1
DISARMED LED=0

10
SEE 3223 Microprocessor Alarm
System

5.1.2 : Flow Chart of Exit Mode, Entry Mode, Protective Mode

NO NOTHING MODE EXIT MODE

START START

PRESS “INT 6”
DO
NOTHING

ARMED LED =1
DISARMED LED =0
END SYSTEM ARMED
SYSTEM
DISARMED

DO=10

D0 =D0 -1
DELAY 1S
DISPLAYED D0
NO

DO =0?

YES

PROTECTIVE
MODE

11

P
SEE 3223 Microprocessor Alarm
System

ENTRY MODE

PROTECTION MODE

NO
MAINDOOR
Q OPEN?

YES

DO=10

D0 =D0 -1
DELAY 2S
DISPLAYED D0
NO

DO =0?

YES
SIREN NO
ARMED LED =1 ENTER CORRECT
SIREN LED =1 PASSWORD?
SOUND=1

YES

SYSTEM DISARMED
ARMED LED = 0
DISARMED LED =1
SIREN LED =0
SOUND=0 12
SEE 3223 Microprocessor Alarm
System

PROTECTIVE MODE

NO
ARMED LED =1 SENSOR 1
SIREN LED = 1 =1?
SECTOR1 LED = 1

YES

ARMED LED =1 NO SENSOR 2


SIREN LED = 1
=1?
SECTOR2 LED = 1

YES

ARMED LED =1 NO SENSOR 3


SIREN LED = 1
=1?
SECTOR3 LED = 1

YES

ARMED LED =1 NO SENSOR 4


SIREN LED = 1
=1?
SECTOR4 LED = 1

YES

P
13
SEE 3223 Microprocessor Alarm
System

5.2 IDE 68k Alarm System Design

14
SEE 3223 Microprocessor Alarm
System

15
SEE 3223 Microprocessor Alarm
System

16
SEE 3223 Microprocessor Alarm
System

17
SEE 3223 Microprocessor Alarm
System

18
SEE 3223 Microprocessor Alarm
System

6: Corresponding Peripherals of IDE 68k in this program


6.1.LED

DISARMED COUNT SECTOR SECTOR


DONE 4 2

SECTOR SECTOR
ARMED SIREN 3 1

6.2. SWITCH

PASSWORD SECTOR4 SECTOR2 MAINDOOR


BIT#1 SENSOR SENSOR
1

PASSWORD PASSWORD SECTOR3 SECTOR1


BIT#2 BIT#0 SENSOR SENSOR
1 1

19
SEE 3223 Microprocessor Alarm
System

6.3.Seven Segment Display

20
SEE 3223 Microprocessor Alarm
System

7.Discussion

7.1 Discussion on Interrupt, Exception and Trap


The program will run start from the main function at address $2000. If the
interrupt button was pushed, corresponding interrupt function will be
executed. After the interrupt functions ended. Program counter will point to
the main program and continued.

Interrupt function
Interrupt 4
First, Interrupt function 4 will start by display the name of the Group
member.
Start from Damian, Ngo and sam
Output:

Secondly, it will intialise D0=5, D1=10. It will perform the function


D1=D0/D1 continuously. It will reached a stage where
D1=0. Hence , it will perform a “divide by zero exception”. It is denoted by
MOVE.B #%01010101 ,$E003.
Output:

Finally, it will run Trap #9 function which will terminate the program. We
need to reset the program in order to run it again.

21
SEE 3223 Microprocessor Alarm
System

7.2 Discussion on IDE 68k’s Alarm System

Interrupt 5 function to armed the alarm system. It is denoted by


Armed LED=1
Disarmed Led=0

The system is enter the exit mode, end counter will count for 10 amd displau in
seven segment display.

“out”symbolize the user is exit the house

When the counter finish count, it will go into protective mode which denoted by
“Prot”at seven segment display and armed LED=1 .

In the protective mode. If the main door open (switch0=1) the program will enter
the “entry mode”counter will count 10 times with 2 second delay each time.

“in”symbolize the user is enter the house.

During the counting time, correct password need to enter to disarmed the alarm
The correct password is #%11110000
If the password correct: disarmed LED=1, seven segment display: “darm”

22
SEE 3223 Microprocessor Alarm
System

If the password is incorrect or no password is key in after the counting time. The
alarm will triggered. It will denoted by
Armed LED=1
Siren LED =1
Seven Segment display : “beeP”
Sound =1

To disarmed the alarm, correct password need to be entered and press


the disarmed interrupt (interrupt 7)
if the password correct, the system will be disarmed and denoted by
Disarmed LED=1
Seven segment display : “darm”

If the password still incorrect, the alarm is remained triggered.

23
SEE 3223 Microprocessor Alarm
System

In the protective mode. If the main door not open (switch0=0) the program will
remained at the “protective mode”. which denoted by “Prot”at seven segment
display and armed LED=1 .

If any sensor switch is triggered. The alarm system will be triggered as well.
Example: sensor 2 is triggered
Output: Armed LED=1
Siren LED=1
Sensor 2 LED=1
Sound =1
Seven Segment display : “beeP”

If no sensor switch is triggered. The alarm system will remained at protective


mode

To disarmed the triggered alarm, user can only use the interrupt 7 (disarmed
interrupt) and key in the correct password,
The alarm remained triggered as long as incorrect password is keyed in.

24
SEE 3223 Microprocessor Alarm
System

8.0 Conclusion

1. The requirements stated were fulfilled by comparing the output

of the program.

2. The alarm system design was functioning.

3. The output of the program were obtained through the 68k

Visual Simulator.

4. Students were trying to some part of the program by using

Flight 68k.

25
SEE 3223 Microprocessor Alarm
System

9.0 References

1. Lecturer notes of SEE3223 Microprocessor by Mr Kamal Khalil

2. Microprocessor Theory and Applications with 68000/68020 and Pentium

by M. RAFIQUZZAMAN, Ph.D.

26
SEE 3223 Microprocessor Alarm
System

10. Soft Copy Of Simulation file

27

You might also like