The Fire Alarm System
Am going to show you how to design and simulate a fire alarm system using the Proteus EDA where we shall be using the 8051 AT89C51 microcontroller to drive the system.
In this project we shall be using the 8051 Microcontroller to run a fire alarm system that will be used as a safety measure for most of the homes and commercial premises to warn the people in case of a fire outbreak.
The system consist of several modules that will be having different functions. The display module which will be made up of the LM016L LCD will be our display module where it shall be displaying messages to the occupants. I f we have fire outbreak, the display will read ,'FIRE OCCURRED' and if we shall not have fire the system shall display 'FIRE ALARM SYSTEM'. The buzzer module will raise the alarm while the motor module will open all the doors and emergency openings. The AT89C51 will be the control module for the system. The code for the project will be in .hex file which I did in KEIL IDE.
Components:
1. 8051 Microcontroller
2. The Display LCD- LM016L
3. The DC Motor
4. The Buzzer.
5. Logic State.
Code:
ORG 0000H
LJMP 0997H
ORG 0800H
MOV 0F0H,#08H
MOV 82H,#00H
MOV A,R7
ADD A,R7
MOV R7,A
MOV A,R6
RLC A
MOV R6,A
XCH A,R5
RLC A
XCH A,R5
XCH A,R4
RLC A
XCH A,R4
XCH A,82H
RLC A
XCH A,82H
SUBB A,R3
MOV A,R5
SUBB A,R2
MOV A,R4
SUBB A,R1
MOV A,82H
SUBB A,R0
JC 0CH
MOV 82H,A
MOV A,R6
SUBB A,R3
MOV R6,A
MOV A,R5
SUBB A,R2
MOV R5,A
MOV A,R4
SUBB A,R1
MOV R4,A
INC R7
DJNZ 0F0H,0D6H
CLR A
XCH A,R6
MOV R3,A
CLR A
XCH A,R5
MOV R2,A
CLR A
XCH A,R4
MOV R1,A
MOV R0,82H
RET
CJNE R0,#00H,0C1H
CJNE R1,#00H,59H
CJNE R2,#00H,2DH
MOV A,R4
MOV 0F0H,R3
DIV AB
XCH A,R7
XCH A,R6
XCH A,R5
MOV R4,A
MOV A,0F0H
XCH A,R3
MOV R1,A
MOV R0,#18H
MOV A,R7
ADD A,R7
MOV R7,A
MOV A,R6
RLC A
MOV R6,A
MOV A,R5
RLC A
MOV R5,A
MOV A,R4
RLC A
MOV R4,A
MOV A,R3
RLC A
MOV R3,A
JBC 0D7H,03H
SUBB A,R1
JC 04H
MOV A,R3
SUBB A,R1
MOV R3,A
INC R7
DJNZ R0,0E5H
CLR A
MOV R1,A
MOV R2,A
RET
MOV R0,#18H
MOV A,R7
ADD A,R7
MOV R7,A
MOV A,R6
RLC A
MOV R6,A
MOV A,R5
RLC A
MOV R5,A
MOV A,R4
RLC A
MOV R4,A
XCH A,R1
RLC A
XCH A,R1
JBC 0D7H,05H
SUBB A,R3
MOV A,R1
SUBB A,R2
JC 07H
MOV A,R4
SUBB A,R3
MOV R4,A
MOV A,R1
SUBB A,R2
MOV R1,A
INC R7
DJNZ R0,0E0H
CLR A
XCH A,R1
MOV R2,A
CLR A
XCH A,R4
MOV R3,A
RET
MOV 0F0H,#10H
MOV A,R7
ADD A,R7
MOV R7,A
MOV A,R6
RLC A
MOV R6,A
MOV A,R5
RLC A
MOV R5,A
XCH A,R4
RLC A
XCH A,R4
XCH A,R0
RLC A
XCH A,R0
JBC 0D7H,07H
SUBB A,R3
MOV A,R4
SUBB A,R2
MOV A,R0
SUBB A,R1
JC 0AH
MOV A,R5
SUBB A,R3
MOV R5,A
MOV A,R4
SUBB A,R2
MOV R4,A
MOV A,R0
SUBB A,R1
MOV R0,A
INC R7
DJNZ 0F0H,0DAH
CLR A
XCH A,R5
MOV R3,A
CLR A
XCH A,R4
MOV R2,A
CLR A
XCH A,R0
MOV R1,A
RET
MOV A,R3
SUBB A,R7
MOV 0F0H,A
MOV A,R2
SUBB A,R6
ORL 0F0H,A
MOV A,R1
SUBB A,R5
ORL 0F0H,A
MOV A,R0
SUBB A,R4
ORL A,0F0H
RET
MOV A,#01H
MOV R7,A
RLC A
SUBB A,0E0H
MOV R6,A
MOV R5,A
MOV R4,A
INC R0
INC R0
INC R0
MOV A,@R0
ADD A,R7
MOV R7,A
MOV @R0,A
DEC R0
MOV A,@R0
ADDC A,R6
MOV R6,A
MOV @R0,A
DEC R0
MOV A,@R0
ADDC A,R5
MOV R5,A
MOV @R0,A
DEC R0
MOV A,@R0
ADDC A,R4
MOV R4,A
MOV @R0,A
RET
MOV 19H,R7
MOV 18H,R6
MOV 17H,R5
MOV 16H,R4
CLR A
MOV R3,#0E8H
MOV R2,#03H
MOV R1,A
MOV R0,A
LCALL 083CH
MOV A,#08H
ADD A,R7
MOV R0,A
MOV A,@R0
MOV 80H,A
SETB 0A0H
MOV R7,#1EH
LCALL 0A5CH
CLR 0A0H
CLR A
MOV R3,#64H
MOV R2,A
MOV R1,A
MOV R0,A
MOV R7,19H
MOV R6,18H
MOV R5,17H
MOV R4,16H
LCALL 083CH
CLR A
MOV R3,#0AH
MOV R2,A
MOV R1,A
MOV R0,A
LCALL 083CH
MOV A,#08H
ADD A,R3
MOV R0,A
MOV A,@R0
MOV 80H,A
SETB 0A1H
MOV R7,#1EH
LCALL 0A5CH
CLR 0A1H
CLR A
MOV R3,#0AH
MOV R2,A
MOV R1,A
MOV R0,A
MOV R7,19H
MOV R6,18H
MOV R5,17H
MOV R4,16H
LCALL 083CH
CLR A
MOV R3,#0AH
MOV R2,A
MOV R1,A
MOV R0,A
LCALL 083CH
MOV A,#08H
ADD A,R3
MOV R0,A
MOV A,@R0
MOV 80H,A
SETB 0A2H
MOV R7,#1EH
LCALL 0A5CH
CLR 0A2H
CLR A
MOV R3,#0AH
MOV R2,A
MOV R1,A
MOV R0,A
MOV R7,19H
MOV R6,18H
MOV R5,17H
MOV R4,16H
LCALL 083CH
MOV A,#08H
ADD A,R3
MOV R0,A
MOV A,@R0
MOV 80H,A
SETB 0A3H
MOV R7,#1EH
LCALL 0A5CH
CLR 0A3H
RET
MOV R0,#7FH
CLR A
MOV @R0,A
DJNZ R0,0FDH
MOV 81H,#19H
LJMP 09DEH
LJMP 0A23H
CLR A
MOVC A,@A+DPTR
INC DPTR
MOV R0,A
CLR A
MOVC A,@A+DPTR
INC DPTR
JC 03H
MOV @R0,A
SJMP 01H
MOVX @R0,A
INC R0
DJNZ R7,0F4H
SJMP 29H
CLR A
MOVC A,@A+DPTR
INC DPTR
MOV R0,A
ANL A,#07H
ADD A,#0CH
XCH A,R0
CLR C
RLC A
SWAP A
ANL A,#0FH
ORL A,#20H
XCH A,R0
MOVC A,@A+PC
JC 04H
CPL A
ANL A,@R0
SJMP 01H
ORL A,@R0
MOV @R0,A
DJNZ R7,0E4H
SJMP 0BH
AJMP 002H
INC A
INC R0
JBC 20H,40H
SJMP 90H
INC R2
ACALL 3E4H
MOV R6,#01H
MOVC A,@A+DPTR
JZ 0BCH
INC DPTR
MOV R7,A
ANL A,#3FH
JNB 0E5H,09H
ANL A,#1FH
MOV R6,A
CLR A
MOVC A,@A+DPTR
INC DPTR
JZ 01H
INC R6
XCH A,R7
ANL A,#0C0H
ADD A,0E0H
JZ 0A8H
JC 0B8H
CLR A
MOVC A,@A+DPTR
INC DPTR
MOV R2,A
CLR A
MOVC A,@A+DPTR
INC DPTR
MOV R0,A
CLR A
MOVC A,@A+DPTR
INC DPTR
XCH A,R0
XCH A,82H
XCH A,R0
XCH A,R2
XCH A,83H
XCH A,R2
MOVX @DPTR,A
INC DPTR
XCH A,R0
XCH A,82H
XCH A,R0
XCH A,R2
XCH A,83H
XCH A,R2
DJNZ R7,0E9H
DJNZ R6,0E7H
SJMP 0BEH
CLR A
MOV 15H,#01H
MOV 14H,A
MOV 13H,A
MOV 12H,A
MOV R0,#12H
LCALL 08DFH
MOV 15H,R7
MOV 14H,R6
MOV 13H,R5
MOV 12H,R4
LCALL 08FFH
CLR A
MOV R7,#0FH
MOV R6,#27H
MOV R5,A
MOV R4,A
MOV R3,15H
MOV R2,14H
MOV R1,13H
MOV R0,12H
CLR C
LCALL 08CEH
JNZ 0DBH
MOV 15H,A
MOV 14H,A
MOV 13H,A
MOV 12H,A
SJMP 0D1H
MOV A,R7
MOV R5,A
RLC A
SUBB A,0E0H
MOV R4,A
SETB C
MOV A,R5
SUBB A,#00H
MOV A,R4
XRL A,#80H
SUBB A,#80H
JC 03H
DEC R7
SJMP 0ECH
RET
INC R2
INC R0
PUSH 0F9H
MUL AB
ANL C,/99H
MOV 82H,C
MOV R0,A
SJMP 90H
NOP
END
The system consist of several modules that will be having different functions. The display module which will be made up of the LM016L LCD will be our display module where it shall be displaying messages to the occupants. I f we have fire outbreak, the display will read ,'FIRE OCCURRED' and if we shall not have fire the system shall display 'FIRE ALARM SYSTEM'. The buzzer module will raise the alarm while the motor module will open all the doors and emergency openings. The AT89C51 will be the control module for the system. The code for the project will be in .hex file which I did in KEIL IDE.
Components:
1. 8051 Microcontroller
2. The Display LCD- LM016L
3. The DC Motor
4. The Buzzer.
5. Logic State.
Code:
ORG 0000H
LJMP 0997H
ORG 0800H
MOV 0F0H,#08H
MOV 82H,#00H
MOV A,R7
ADD A,R7
MOV R7,A
MOV A,R6
RLC A
MOV R6,A
XCH A,R5
RLC A
XCH A,R5
XCH A,R4
RLC A
XCH A,R4
XCH A,82H
RLC A
XCH A,82H
SUBB A,R3
MOV A,R5
SUBB A,R2
MOV A,R4
SUBB A,R1
MOV A,82H
SUBB A,R0
JC 0CH
MOV 82H,A
MOV A,R6
SUBB A,R3
MOV R6,A
MOV A,R5
SUBB A,R2
MOV R5,A
MOV A,R4
SUBB A,R1
MOV R4,A
INC R7
DJNZ 0F0H,0D6H
CLR A
XCH A,R6
MOV R3,A
CLR A
XCH A,R5
MOV R2,A
CLR A
XCH A,R4
MOV R1,A
MOV R0,82H
RET
CJNE R0,#00H,0C1H
CJNE R1,#00H,59H
CJNE R2,#00H,2DH
MOV A,R4
MOV 0F0H,R3
DIV AB
XCH A,R7
XCH A,R6
XCH A,R5
MOV R4,A
MOV A,0F0H
XCH A,R3
MOV R1,A
MOV R0,#18H
MOV A,R7
ADD A,R7
MOV R7,A
MOV A,R6
RLC A
MOV R6,A
MOV A,R5
RLC A
MOV R5,A
MOV A,R4
RLC A
MOV R4,A
MOV A,R3
RLC A
MOV R3,A
JBC 0D7H,03H
SUBB A,R1
JC 04H
MOV A,R3
SUBB A,R1
MOV R3,A
INC R7
DJNZ R0,0E5H
CLR A
MOV R1,A
MOV R2,A
RET
MOV R0,#18H
MOV A,R7
ADD A,R7
MOV R7,A
MOV A,R6
RLC A
MOV R6,A
MOV A,R5
RLC A
MOV R5,A
MOV A,R4
RLC A
MOV R4,A
XCH A,R1
RLC A
XCH A,R1
JBC 0D7H,05H
SUBB A,R3
MOV A,R1
SUBB A,R2
JC 07H
MOV A,R4
SUBB A,R3
MOV R4,A
MOV A,R1
SUBB A,R2
MOV R1,A
INC R7
DJNZ R0,0E0H
CLR A
XCH A,R1
MOV R2,A
CLR A
XCH A,R4
MOV R3,A
RET
MOV 0F0H,#10H
MOV A,R7
ADD A,R7
MOV R7,A
MOV A,R6
RLC A
MOV R6,A
MOV A,R5
RLC A
MOV R5,A
XCH A,R4
RLC A
XCH A,R4
XCH A,R0
RLC A
XCH A,R0
JBC 0D7H,07H
SUBB A,R3
MOV A,R4
SUBB A,R2
MOV A,R0
SUBB A,R1
JC 0AH
MOV A,R5
SUBB A,R3
MOV R5,A
MOV A,R4
SUBB A,R2
MOV R4,A
MOV A,R0
SUBB A,R1
MOV R0,A
INC R7
DJNZ 0F0H,0DAH
CLR A
XCH A,R5
MOV R3,A
CLR A
XCH A,R4
MOV R2,A
CLR A
XCH A,R0
MOV R1,A
RET
MOV A,R3
SUBB A,R7
MOV 0F0H,A
MOV A,R2
SUBB A,R6
ORL 0F0H,A
MOV A,R1
SUBB A,R5
ORL 0F0H,A
MOV A,R0
SUBB A,R4
ORL A,0F0H
RET
MOV A,#01H
MOV R7,A
RLC A
SUBB A,0E0H
MOV R6,A
MOV R5,A
MOV R4,A
INC R0
INC R0
INC R0
MOV A,@R0
ADD A,R7
MOV R7,A
MOV @R0,A
DEC R0
MOV A,@R0
ADDC A,R6
MOV R6,A
MOV @R0,A
DEC R0
MOV A,@R0
ADDC A,R5
MOV R5,A
MOV @R0,A
DEC R0
MOV A,@R0
ADDC A,R4
MOV R4,A
MOV @R0,A
RET
MOV 19H,R7
MOV 18H,R6
MOV 17H,R5
MOV 16H,R4
CLR A
MOV R3,#0E8H
MOV R2,#03H
MOV R1,A
MOV R0,A
LCALL 083CH
MOV A,#08H
ADD A,R7
MOV R0,A
MOV A,@R0
MOV 80H,A
SETB 0A0H
MOV R7,#1EH
LCALL 0A5CH
CLR 0A0H
CLR A
MOV R3,#64H
MOV R2,A
MOV R1,A
MOV R0,A
MOV R7,19H
MOV R6,18H
MOV R5,17H
MOV R4,16H
LCALL 083CH
CLR A
MOV R3,#0AH
MOV R2,A
MOV R1,A
MOV R0,A
LCALL 083CH
MOV A,#08H
ADD A,R3
MOV R0,A
MOV A,@R0
MOV 80H,A
SETB 0A1H
MOV R7,#1EH
LCALL 0A5CH
CLR 0A1H
CLR A
MOV R3,#0AH
MOV R2,A
MOV R1,A
MOV R0,A
MOV R7,19H
MOV R6,18H
MOV R5,17H
MOV R4,16H
LCALL 083CH
CLR A
MOV R3,#0AH
MOV R2,A
MOV R1,A
MOV R0,A
LCALL 083CH
MOV A,#08H
ADD A,R3
MOV R0,A
MOV A,@R0
MOV 80H,A
SETB 0A2H
MOV R7,#1EH
LCALL 0A5CH
CLR 0A2H
CLR A
MOV R3,#0AH
MOV R2,A
MOV R1,A
MOV R0,A
MOV R7,19H
MOV R6,18H
MOV R5,17H
MOV R4,16H
LCALL 083CH
MOV A,#08H
ADD A,R3
MOV R0,A
MOV A,@R0
MOV 80H,A
SETB 0A3H
MOV R7,#1EH
LCALL 0A5CH
CLR 0A3H
RET
MOV R0,#7FH
CLR A
MOV @R0,A
DJNZ R0,0FDH
MOV 81H,#19H
LJMP 09DEH
LJMP 0A23H
CLR A
MOVC A,@A+DPTR
INC DPTR
MOV R0,A
CLR A
MOVC A,@A+DPTR
INC DPTR
JC 03H
MOV @R0,A
SJMP 01H
MOVX @R0,A
INC R0
DJNZ R7,0F4H
SJMP 29H
CLR A
MOVC A,@A+DPTR
INC DPTR
MOV R0,A
ANL A,#07H
ADD A,#0CH
XCH A,R0
CLR C
RLC A
SWAP A
ANL A,#0FH
ORL A,#20H
XCH A,R0
MOVC A,@A+PC
JC 04H
CPL A
ANL A,@R0
SJMP 01H
ORL A,@R0
MOV @R0,A
DJNZ R7,0E4H
SJMP 0BH
AJMP 002H
INC A
INC R0
JBC 20H,40H
SJMP 90H
INC R2
ACALL 3E4H
MOV R6,#01H
MOVC A,@A+DPTR
JZ 0BCH
INC DPTR
MOV R7,A
ANL A,#3FH
JNB 0E5H,09H
ANL A,#1FH
MOV R6,A
CLR A
MOVC A,@A+DPTR
INC DPTR
JZ 01H
INC R6
XCH A,R7
ANL A,#0C0H
ADD A,0E0H
JZ 0A8H
JC 0B8H
CLR A
MOVC A,@A+DPTR
INC DPTR
MOV R2,A
CLR A
MOVC A,@A+DPTR
INC DPTR
MOV R0,A
CLR A
MOVC A,@A+DPTR
INC DPTR
XCH A,R0
XCH A,82H
XCH A,R0
XCH A,R2
XCH A,83H
XCH A,R2
MOVX @DPTR,A
INC DPTR
XCH A,R0
XCH A,82H
XCH A,R0
XCH A,R2
XCH A,83H
XCH A,R2
DJNZ R7,0E9H
DJNZ R6,0E7H
SJMP 0BEH
CLR A
MOV 15H,#01H
MOV 14H,A
MOV 13H,A
MOV 12H,A
MOV R0,#12H
LCALL 08DFH
MOV 15H,R7
MOV 14H,R6
MOV 13H,R5
MOV 12H,R4
LCALL 08FFH
CLR A
MOV R7,#0FH
MOV R6,#27H
MOV R5,A
MOV R4,A
MOV R3,15H
MOV R2,14H
MOV R1,13H
MOV R0,12H
CLR C
LCALL 08CEH
JNZ 0DBH
MOV 15H,A
MOV 14H,A
MOV 13H,A
MOV 12H,A
SJMP 0D1H
MOV A,R7
MOV R5,A
RLC A
SUBB A,0E0H
MOV R4,A
SETB C
MOV A,R5
SUBB A,#00H
MOV A,R4
XRL A,#80H
SUBB A,#80H
JC 03H
DEC R7
SJMP 0ECH
RET
INC R2
INC R0
PUSH 0F9H
MUL AB
ANL C,/99H
MOV 82H,C
MOV R0,A
SJMP 90H
NOP
END
Discussion (0 comments)