Upload
ravi-talsaniya
View
224
Download
0
Embed Size (px)
Citation preview
7/29/2019 Rfid Based Home Security System
1/29
BY RAVI-RAJKOT RFID based home security system.
Programming :
org 0000h
ljmp main
org 0003h
ljmp in0
org 000bh
ljmp time0
org 0030h
main: mov sp,#0fh
7/29/2019 Rfid Based Home Security System
2/29
mov ie,#10000011b
setb tcon.0
mov 20h,#00h
mov 21h,#00h
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
mov r1,#30d ;for 30 second delay
mov r0,#20d ;for 1 second delay
mov th0,#3ch
mov tl0,#0b0h
mov tmod,#21h ;timer 0 is used to generate 30 sec. delay
;timer 1 is used to generate baud rate
mov th1,#0fah
mov scon,#50h
setb tr1
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
mov p1,#0ffh ;p1.0,1.1,1.2 sensor inputs
clr p2.5 ;alarm
clr p2.3 ;enable status
clr p2.4
7/29/2019 Rfid Based Home Security System
3/29
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;a subroutine to intialize LCD as 2 lines 16*2
mov a,#38h ;Init. LCD 2 lines, 5*7 matrix
acall command
mov a,#0eh ;LCD on, cursor on
acall command
mov a,#06h ;Shift cursor right
acall command
;a subroutine to display set temperature in 1st line
;bit 00h is indicating enable disable status
display: clr 01h
jb 00h,enabling1
sjmp disable
enabling1: ljmp enabling
;;;;displaying home sec. sys disabled
disable: clr p2.5
clr p2.3
7/29/2019 Rfid Based Home Security System
4/29
setb p2.4
mov a,#01h ;clear LCD command
acall command
mov a,#81h ;cursor line 1 position 1
acall command
mov a,#'H'
acall datadisplay
mov a,#'o'
acall datadisplay
mov a,#'m'
acall datadisplay
mov a,#'e'
acall datadisplay
mov a,#' '
acall datadisplay
mov a,#'S'
acall datadisplay
mov a,#'e'
7/29/2019 Rfid Based Home Security System
5/29
acall datadisplay
mov a,#'c'
acall datadisplay
mov a,#'.'
acall datadisplay
mov a,#'S'
acall datadisplay
mov a,#'y'
acall datadisplay
mov a,#'s'
acall datadisplay
;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;
mov a,#0c1h ;cursor line 1 position 1
acall command
mov a,#'S'
acall datadisplay
7/29/2019 Rfid Based Home Security System
6/29
mov a,#'t'
acall datadisplay
mov a,#'a'
acall datadisplay
mov a,#'t'
acall datadisplay
mov a,#'u'
acall datadisplay
mov a,#'s'
acall datadisplay
mov a,#' '
acall datadisplay
mov a,#'-'
acall datadisplay
mov a,#' '
acall datadisplay
mov a,#'d'
acall datadisplay
7/29/2019 Rfid Based Home Security System
7/29
mov a,#'`'
acall datadisplay
mov a,#'b'
acall datadisplay
mov a,#'l'
acall datadisplay
mov a,#'e'
acall datadisplay
mov a,#'d'
acall datadisplay
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
check: jb 01h,display1
sjmp check
display1: ljmp display
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;enabling system
7/29/2019 Rfid Based Home Security System
8/29
enabling: setb tr0
setb p2.3
setb p2.4
mov a,#01h
acall command
mov a,#81h ;cursor line 1 position 1
acall command
mov a,#'E'
acall datadisplay
mov a,#'n'
acall datadisplay
mov a,#'a'
acall datadisplay
mov a,#'b'
acall datadisplay
mov a,#'l'
acall datadisplay
mov a,#'i'
acall datadisplay
7/29/2019 Rfid Based Home Security System
9/29
mov a,#'n'
acall datadisplay
mov a,#'g'
acall datadisplay
mov a,#'.'
acall datadisplay
mov a,#'.'
acall datadisplay
mov a,#'.'
acall datadisplay
mov a,#'.'
acall datadisplay
checkk: jnb 02h,checkk
;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;
7/29/2019 Rfid Based Home Security System
10/29
enable: clr 02h ;time indication to cancel
setb p2.3
clr p2.4
mov a,#01h
acall command
mov a,#81h ;cursor line 1 position 1
acall command
mov a,#'H'
acall datadisplay
mov a,#'o'
acall datadisplay
mov a,#'m'
acall datadisplay
mov a,#'e'
acall datadisplay
mov a,#' '
acall datadisplay
mov a,#'S'
7/29/2019 Rfid Based Home Security System
11/29
acall datadisplay
mov a,#'e'
acall datadisplay
mov a,#'c'
acall datadisplay
mov a,#'.'
acall datadisplay
mov a,#'S'
acall datadisplay
mov a,#'y'
acall datadisplay
mov a,#'s'
acall datadisplay
;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;
mov a,#0c1h ;cursor line 1 position 1
acall command
7/29/2019 Rfid Based Home Security System
12/29
mov a,#'S'
acall datadisplay
mov a,#'t'
acall datadisplay
mov a,#'a'
acall datadisplay
mov a,#'t'
acall datadisplay
mov a,#'u'
acall datadisplay
mov a,#'s'
acall datadisplay
mov a,#' '
acall datadisplay
mov a,#'-'
acall datadisplay
mov a,#' '
acall datadisplay
7/29/2019 Rfid Based Home Security System
13/29
mov a,#'e'
acall datadisplay
mov a,#'`'
acall datadisplay
mov a,#'b'
acall datadisplay
mov a,#'l'
acall datadisplay
mov a,#'e'
acall datadisplay
mov a,#'d'
acall datadisplay
check2: jb p1.0,intruder
jb p1.1,door11
jb p1.2,door22
sjmp check2
door11: ljmp door1
door22: ljmp door2
7/29/2019 Rfid Based Home Security System
14/29
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
intruder: setb tr0
wait1: jnb 02h,wait1
clr 02h
jb 00h,conti
setb 01h
ljmp check
conti: setb p2.5
mov a,#081h ;cursor line 1 position 1
acall command
mov a,#' '
acall datadisplay
mov a,#' '
acall datadisplay
mov a,#' '
acall datadisplay
mov a,#' '
7/29/2019 Rfid Based Home Security System
15/29
acall datadisplay
mov a,#'A'
acall datadisplay
mov a,#'l'
acall datadisplay
mov a,#'a'
acall datadisplay
mov a,#'r'
acall datadisplay
mov a,#'m'
acall datadisplay
mov a,#' '
acall datadisplay
mov a,#' '
acall datadisplay
mov a,#' '
acall datadisplay
mov a,#0c1h ;cursor line 1 position 1
7/29/2019 Rfid Based Home Security System
16/29
acall command
mov a,#' '
acall datadisplay
mov a,#' '
acall datadisplay
mov a,#' '
acall datadisplay
mov a,#' '
acall datadisplay
mov a,#'I'
acall datadisplay
mov a,#'N'
acall datadisplay
mov a,#'T'
acall datadisplay
mov a,#'R'
acall datadisplay
mov a,#'U'
7/29/2019 Rfid Based Home Security System
17/29
acall datadisplay
mov a,#'D'
acall datadisplay
mov a,#'E'
acall datadisplay
mov a,#'R'
acall datadisplay
setb 04h
acall message
her1: jb 00h,her1
ljmp check
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;Door 1
door1: setb tr0
wait2: jnb 02h,wait2
clr 02h
jb 00h,conti1
setb 01h
7/29/2019 Rfid Based Home Security System
18/29
ljmp check
conti1: setb p2.5
mov a,#081h ;cursor line 1 position 1
acall command
mov a,#' '
acall datadisplay
mov a,#' '
acall datadisplay
mov a,#' '
acall datadisplay
mov a,#' '
acall datadisplay
mov a,#'A'
acall datadisplay
mov a,#'l'
acall datadisplay
mov a,#'a'
acall datadisplay
7/29/2019 Rfid Based Home Security System
19/29
mov a,#'r'
acall datadisplay
mov a,#'m'
acall datadisplay
mov a,#' '
acall datadisplay
mov a,#' '
acall datadisplay
mov a,#' '
acall datadisplay
mov a,#0c1h ;cursor line 1 position 1
acall command
mov a,#' '
acall datadisplay
mov a,#' '
acall datadisplay
mov a,#' '
acall datadisplay
7/29/2019 Rfid Based Home Security System
20/29
mov a,#' '
acall datadisplay
mov a,#'D'
acall datadisplay
mov a,#'O'
acall datadisplay
mov a,#'O'
acall datadisplay
mov a,#'R'
acall datadisplay
mov a,#'1'
acall datadisplay
mov a,#' '
acall datadisplay
mov a,#' '
acall datadisplay
mov a,#' '
acall datadisplay
7/29/2019 Rfid Based Home Security System
21/29
setb 05h
acall message
her2: jb 00h,her2
ljmp check
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;Door 1
door2: setb tr0
wait3: jnb 02h,wait3
clr 02h
jb 00h,conti2
setb 01h
ljmp check
conti2: setb p2.5
mov a,#081h ;cursor line 1 position 1
acall command
mov a,#' '
acall datadisplay
7/29/2019 Rfid Based Home Security System
22/29
mov a,#' '
acall datadisplay
mov a,#' '
acall datadisplay
mov a,#' '
acall datadisplay
mov a,#'A'
acall datadisplay
mov a,#'l'
acall datadisplay
mov a,#'a'
acall datadisplay
mov a,#'r'
acall datadisplay
mov a,#'m'
acall datadisplay
mov a,#' '
acall datadisplay
7/29/2019 Rfid Based Home Security System
23/29
mov a,#' '
acall datadisplay
mov a,#' '
acall datadisplay
mov a,#0c1h ;cursor line 1 position 1
acall command
mov a,#' '
acall datadisplay
mov a,#' '
acall datadisplay
mov a,#' '
acall datadisplay
mov a,#' '
acall datadisplay
mov a,#'D'
acall datadisplay
mov a,#'O'
acall datadisplay
7/29/2019 Rfid Based Home Security System
24/29
mov a,#'O'
acall datadisplay
mov a,#'R'
acall datadisplay
mov a,#'1'
acall datadisplay
mov a,#' '
acall datadisplay
mov a,#' '
acall datadisplay
mov a,#' '
acall datadisplay
setb 06h
acall message
her3: jb 00h,her3
ljmp check
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
7/29/2019 Rfid Based Home Security System
25/29
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
command: acall ready
mov p0,a
clr p2.0
clr p2.1
setb p2.2
clr p2.2
ret
datadisplay: acall ready
mov p0,a
setb p2.0
clr p2.1
setb p2.2
clr p2.2
ret
ready: setb p0.7
clr p2.0
setb p2.1
back: clr p2.2
setb p2.2
jb p0.7,back
ret
7/29/2019 Rfid Based Home Security System
26/29
;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
message:mov dptr,#first
acall serial
mov dptr,#second
acall serial
mov a,#'"'
acall send
mov dptr,#numb
acall serial
mov a,#'"'
acall send
jb 04h,intru
jb 05h,dor1
jb 06h,dor2
intru: clr 04h
mov dptr,#msg1
acall serial
ret
7/29/2019 Rfid Based Home Security System
27/29
dor1: clr 05h
mov dptr,#msg2
acall serial
ret
dor2: clr 06h
mov dptr,#msg3
acall serial
ret
serial: clr A
movc a,@a+dptr
jz complete
acall send
inc dptr
sjmp serial
complete:ret
send: mov sbuf,a
her: jnb ti,her
clr ti
ret
first: DB "AT+CMGF=1",0dh,0ah,0 ;9
second: DB "AT+CMGS=",0
7/29/2019 Rfid Based Home Security System
28/29
numb: DB "94284xxxxx",0
msg1: DB 0dh,0ah,"Intruder alert",1ah,0 ;6
msg2: DB 0dh,0ah,"Door1 alert",1ah,0
msg3: DB 0dh,0ah,"Door2 alert",1ah,0
;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
in0: cpl 00h
setb 01h
reti
;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
time0: djnz r0,next
djnz r1,next1
clr tr0
setb 02h
mov r1,#30d
next1: mov r0,#20d
7/29/2019 Rfid Based Home Security System
29/29
next: mov th0,#3ch
mov tl0,#0b0h
reti
;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
end