Professional Documents
Culture Documents
Program Code of Auto Dialer (1) Programing
Program Code of Auto Dialer (1) Programing
relay equ
p2.2
buz
p2.3
equ
motor equ
p2.0
motor1 equ
p2.1
voice1 equ
p2.4
voice2 equ
p2.5
voice3 equ
p2.6
fire equ
p3.1
gas
p3.2
equ
switch1 equ
p1.0
switch2 equ
p1.1
switch3 equ
p1.2
switch4 equ
p1.3
switch5 equ
p1.4
switch6 equ
p1.5
switch7 equ
p1.6
; switch8 equ
p3.1
; switch9 equ
p3.0
ORG 0000H
SJMP MAIN
MAIN:
KEYCHECK:
JNB switch1,OK_1
JNB switch2,WRONG
JNB switch3,WRONG
JNB switch4,WRONG
JNB switch5,WRONG
JNB switch6,WRONG
JNB switch7,WRONG
jnb switch8,wrong
jnb switch9,wrong
jnb fire,wrong1
jnb gas,wrong2
SJMP KEYCHECK
wrong1:ljmp wrong2_act
wrong2:ljmp wrong3_act
ok_1: ljmp ok
WRONG:
ACALL DELAY
CLR BUZ
CLR RELAY
acall delay2
SETB RELAY
setb relay
H1:
CLR BUZ
ACALL DELAY3
SETB BUZ
ACALL DELAY3
DJNZ R7,H1
voicelock:
clr voice1
acall delay
setb voice1
lJMP KEYCHECK
wrong2_act:
CLR BUZ
CLR RELAY
ACALL DELAY2
SETB RELAY
MOV R7,#10
H2:
CLR BUZ
ACALL DELAY3
SETB BUZ
ACALL DELAY3
DJNZ R7,H2
voicefire:
clr voice2
acall delay
setb voice2
lJMP KEYCHECK
WRONG3_act:
clr p2.7
CLR BUZ
CLR RELAY
ACALL DELAY
SETB RELAY
ACALL DELAY2
MOV R7,#10
H3:
CLR BUZ
ACALL DELay
SETB BUZ
ACALL DELAY
DJNZ R7,H3
voicegas:
clr voice3
acall delay3
setb voice3
lJMP KEYCHECK
OK:
JNB switch1,WRONG_4
JNB switch3,OK1
JNB switch4,WRONG_4
JNB switch5,WRONG_4
JNB switch6,WRONG_4
JNB switch7,WRONG_4
;
JNB switch8,WRONG_4
SJMP OK
OK1:
JNB switch1,WRONG_n
JNB switch2,WRONG_n
JNB switch5,OK2
JNB switch4,WRONG_n
JNB switch6,WRONG_n
JNB switch7,WRONG_n
;
JNB switch8,WRONG_n
SJMP OK1
OK2:
JNB switch1,WRONG_6
JNB switch2,WRONG_6
JNB switch3,WRONG_6
JNB switch7,OK3
JNB switch4,WRONG_6
JNB switch8,WRONG_6
wrong_6:ljmp wrong
OK3:
acall delay4
act:
clr buz
; buzzer
clr motor
setb motor1
acall delay1
setb buz
; buzzer off
setb motor
setb motor1
acall delay1
setb motor
clr motor1
acall delay
setb motor
setb motor1
ljmp main
delay1:
mov r3,#00
mov r2,#00
mov r1,#12
delay:
djnz r3,delay
djnz r2,delay
djnz r1,delay
ret
DELAY2:
MOV R4,#00
MOV R5,#00
MOV R6,#10
SIM:
DJNZ R4,SIM
DJNZ R5,SIM
DJNZ R6,SIM
RET
DELAY3:
MOV R1,#00
MOV R2,#00
MOV R3,#3
DIM:
DJNZ R1,DIM
DJNZ R2,DIM
DJNZ R3,DIM
RET