Прошу Вашей помощи. Грабанули квартиру теперь срочно делаю сигнализацию Здравствуйте
Прошу Вашей помощи.
Грабанули квартиру теперь срочно делаю сигнализацию.
Точнее переделываю проект Леонида Ивановича
(http://www.telesys …ts/proj054/index.shtml) на далласе.
После походов по милиции голова не варит никак не могу сделать
следующее
кнопка open используется в качестве охранного шлейфа.
далассом производитсяф постановка и снятие с охраны при этом
издается короткий сигнал (solen=0) а при разрыве в режиме охраны
включается сирена на постоянно, но хочу переделать чтобы минут на
20 вкл сирена потом 10 минут перерыв и снова на 10-15 минут включилась
(т.е. 2 раза с перерывом) далее если двери закрыли берется снова под охрану если нет
оснается отключенной до новой постановки ключем даллас.
но как сделать не веду после нервотрепки.
Помогите пожалуйста.
пологаю что надо так но что то не получается
trevTMV .EQU 60 000 ;x20mS задержка 20 минут
.
.
.
.
;=====MY TREVOGA=====
TREVOGA: JB OXPAHA,ONBIP
SETB SOLEN
JNB OXPAHA,OFFBIP
ONBIP: CLR SOLEN
OFFBIP: mov trevTM,#trevTMV
RET
.....
...
RTC1: MOV A,TMATM
JZ RTC2
DEC TMATM
RTC2: MOV A,AENTM
JZ RTC3
DEC AENTM
RTC3: MOV A,OPNTM
JZ RTC4
DEC OPNTM
RTC4: MOV A,RETTM
JZ RTC5
DEC RETTM
RTC5: MOV A,trevTM
JZ RTC6
DEC trevTM
RTC6: POP ACC
RETI
ниже приведена программа в которой тревога вкючается на постоянно.
> ; ------ DALLAS DS1990A based lock ------
> ; ------ Supports 9 keys + 1 master-key -----
> ; ------ wubblick@yahoo.com -------
>
> ;TARGET = AT89C2051
> DEBUG = 0 ;0-off, 1-rdfn ports, 2-on
> #INCLUDE "LIBR51.ASM" ;8051 SFR set
>
> CLK_KHZ = 10000 ;OSC frequency, KHZ
> RTC_MS = 20 ;system clock, MS
>
> RTCV = -(CLK_KHZ*RTC_MS)/12
>
> ;Macros:
>
> #DEFINE LO(XXX) XXX & 0FFH
> #DEFINE HI(XXX) (XXX >> 8) & 0FFH
>
#IF (DEBUG>>1)
> #INCLUDE "LIBDEF.ASM"
> #ENDIF
>
> ; ------ Constantes ------
>
> MAXK .EQU 9 ;max number of keys
> I2C_ADDR .EQU 0A0H ;I2C address for 24C02 (A0,A1,A2=0)
> TMATMV .EQU 25 ;x20mS TM access delay time
> AENTMV .EQU 2 ;x20mS TM access enable delay
> OPNTMV .EQU 150 ;x20mS open pulse duration
> RETTMV .EQU 250 ;x20mS return to normal mode delay
>
> ; ------ Ports ------
>
> DDATA .EQU P1 ;display data port
> KEYOP .EQU INT0 ;key OPEN
> OWP .EQU INT1 ;1-Wire port
> SDA .EQU T0 ;I2C SDA line
> SCL .EQU T1 ;I2C SCL line
> SOLEN .EQU RXD ;solenoid control line
> WD .EQU TXD ;watchdog line
> KEYSL .EQU P3.7 ;key SELECT
> INDIC .EQU P1.3 ;====================== AL307
>
> ; ------ Variables ------
>
> ;Bit addressing memory:
>
> RTPC .EQU 020H ;Real time program counter
> T040M .EQU O20H.0 ;40mS period bit
> T080M .EQU O20H.1 ;80mS period bit
> T160M .EQU O20H.2 ;160mS period bit
> T320M .EQU O20H.3 ;320mS period bit
> T640M .EQU O20H.4 ;640mS period bit
> T1S28 .EQU O20H.5 ;1.28S period bit
> T2S56 .EQU O20H.6 ;2.56S period bit
> T5S12 .EQU O20H.7 ;5.12S period bit
>
> RTPCS .EQU 021H ;Real time program counter (100mS part)
>
> FLAGS1 .EQU 022H
> PROG .EQU O22H.0 ;program mode flag
> SNUM .EQU O22H.1 ;set number flag
> BLINK .EQU O22H.2 ;display blink bit
> SLKPR .EQU O22H.3 ;SELECT press flag
> OPNPR .EQU O22H.4 ;OPEN press flag
> OXPAHA .EQU O22H.5 ;=== FLAG OXRANI
>
> ;Internal Data Memory:
>
> .ORG 0030H ;data memory segment
>
> ROMD .DS 8 ;touch memory ROM data
> TEMP .DS 1 ;temporary byte (used in ACCESS90)
>
> TMATM .DS 1 ;touch memory access timer
> AENTM .DS 1 ;TM access enable timer
> OPNTM .DS 1 ;open timer
> RETTM .DS 1 ;return timer
>
> NUM .DS 1 ;current PRG number (1..9)
>
> ;Debugger variables:
>
#IF (DEBUG>>1)
> DBGVA .DS 1 ;debugger variable address in internal memory
> DBGVV .DS 1 ;debugger variable value in internal memory
> DBGA .EQU 0FFFFH ;debugger address in external memory
> #ENDIF
>
> STACK: ;stack location
>
> ; ------ Vectors Area ------
>
> .ORG 0000H ;reset vector
> LJMP INIT
> .ORG 000BH ;INT TIMER 0 vector
> LJMP RTC
>
> ; ------ Main Program ------
>
> INIT: MOV SP,#STACK ;stack init
#IF (DEBUG>>1)
> DEBUGINIT ;debug init
> #ENDIF
>
> ;Variables init:
>
> CLR A
> MOV FLAGS1,A ;clear flags 1
> MOV TMATM,A ;touch memory access timer clear
> MOV AENTM,A ;touch memory access delay timer clear
> MOV OPNTM,A ;open timer clear
> MOV RETTM,A ;return timer clear
>
> ;Periferal setup:
>
> CLR TR0 ;timer 0 stop
> CLR TR1 ;timer 1 stop
> MOV TMOD,#11H ;timer 0 and timer 1 init
> MOV TL0,#LO(RTCV) ;timer 0 load
> MOV TH0,#HI(RTCV)
> SETB TR0 ;timer 0 start
> CLR PT0 ;int. timer 0 low priority
> SETB ET0 ;int. timer 0 enable
> SETB EA ;interrupts enable
>
> ;=====================================MY=============================
> CLR OXPAHA
> SETB INDIC
>
> CLR SOLEN
> LCALL DEL15
> LCALL DEL15
> LCALL DEL15
> SETB SOLEN
> ;======================================MY==============================
> ; ------ Main Loop ------
>
> ;Read touch memory:
>
> MAIN: LCALL ACCESS90 ;read touch memory
> JNC NOTCH ;no touch
> JB PROG,PRG ;jump to process PROG mode
> LCALL CHKMAS ;check for master code
> JC OPN
> LCALL CHKMEM ;check for member code
> JC OPN
> SJMP NOTCH
> PRG: LCALL PROGT ;process PROG mode when touch
> SJMP NOTCH
> OPN: LCALL OXRANA ;===MY SET FLAG OXPAHA!!!!!!=========
>
> ;Check open key:
>
> NOTCH: LCALL CHKOPK ;check open key
> JNC NOOPN
> LCALL TREVOGA ;====MY TREVOGA=========================
>
> ;Check select key:
>
> NOOPN: LCALL CHKSLK ;check select key
> JNC NOCLS
> LCALL PROGS ;process PROG mode when select
>
> ;Return timer check:
>
> NOCLS: MOV A,RETTM
> JNZ NORET
> LCALL RETMD ;return to normal mode
>
> ;Display, watchdog wakeup:
>
> NORET: LCALL DISP ;display
> LCALL WAKEUP ;watchdog wakeup
> LJMP MAIN
>
> ; ------ Subroutines Area ------
>
> ;Process PROG mode when touch:
>
> PROGT: JB SNUM,PRGT1 ;SNUM = 1 ?
> LCALL CHKMAS ;check for master
> JC PRGT3
> RET
>
> PRGT3: SETB SNUM ;set "set number" flag
> CLR BLINK ;clear blink flag
> MOV NUM,#1 ;clear number
> MOV RETTM,#RETTMV ;load return delay
> RET
>
> PRGT1: JB BLINK,PRGT2 ;PROG = 1, BLINK = 0 ?
> SETB BLINK ;set blink flag
> MOV RETTM,#RETTMV ;load return delay
> RET
>
> PRGT2: LCALL SAVE ;NVM[NUM] <- new key
> CLR BLINK ;clear blink flag
> MOV RETTM,#RETTMV ;load return delay
> RET
>
> ;Process PROG mode when select:
>
> PROGS: JB PROG,PRGS1 ;PROG = 1 ?
> SETB PROG ;set program mode flag
> CLR SNUM ;clear "set number" flag
> CLR BLINK ;clear blink flag
> MOV RETTM,#RETTMV ;load return delay
> RET
>
> PRGS1: JNB SNUM,PRGS2 ;SNUM = 0 ?
> CLR BLINK ;clear blink flag
> INC NUM ;NUM + 1
> MOV A,NUM
> CJNE A,#MAXK+1,PRGS2
> MOV NUM,#1
> PRGS2: MOV RETTM,#RETTMV ;load return delay
> RET
>
> ;Return to normal mode:
>
> RETMD: CLR BLINK ;clear blink flag
> CLR PROG ;clear program mode flag
> CLR SNUM ;clear "set number" flag
> RET
>
> ;============MY FLAG OXRANA--------
>
> OXRANA: CPL OXPAHA
> CPL INDIC
> CLR SOLEN
> LCALL DEL15
> LCALL DEL15
> LCALL DEL15
> LCALL DEL15
> LCALL DEL15
> LCALL DEL15
> SETB SOLEN
> RET
>
> ;=====MY TREVOGA=====
>
> TREVOGA: JB OXPAHA,ONBIP
> SETB SOLEN
> JNB OXPAHA,OFFBIP
> ONBIP: CLR SOLEN
> OFFBIP: NOP
> RET
>
>
> ;Check open key:
> ;Returns C=1 if pressed
>
> CHKOPK: JB KEYOP,OP1 ;jump if key OPEN pressed
> CLR OPNPR ;clear OPEN pressed flag
> OP3: CLR C
> RET
>
> OP1: JB OPNPR,OP2
> LCALL DEL15 ;delay 15 mS
> JNB KEYOP,OP3
> SETB OPNPR ;set OPEN pressed flag
> OP2: SETB C ;C <- 1 if key OPEN pressed
> RET
>
> ;Check select key:
> ;Returns C=1 if pressed
>
> CHKSLK: JNB KEYSL,SL1 ;jump if key SELECT pressed
> CLR SLKPR ;clear SELECT pressed flag
> SL2: CLR C
> RET
>
> SL1: JB SLKPR,SL2
> LCALL DEL15 ;delay 15 mS
> JB KEYSL,SL2
> SETB SLKPR ;set SELECT pressed flag
> SETB C ;C <- 1 if key SELECT pressed
> RET
>
> ;Watchdog wakeup:
>
> WAKEUP: MOV C,T040M
> MOV WD,C
> RET
>
> ; ------ 1-Wire bus support ------
>
> ;Send reset pulse to OWP and receive presence pulse
> ;Out: C = 1 if OK
>
> TRESET: PUSH B
> CLR OWP ;OWP <- 0
> MOV B,#CLK_KHZ/48
> DJNZ B,$ ;delay 500 uS
> CLR EA ;interrupt disable
> SETB OWP ;OWP <- 1 (0uS)
>
> MOV B,#CLK_KHZ/2000
> DJNZ B,$ ;delay
> MOV C,OWP ;read OWP (14 uS)
> JNC FAIL ;fail if OWP = 0
>
> MOV B,#CLK_KHZ/500
> DJNZ B,$ ;delay
> MOV C,OWP ;read OWP (66 uS)
> JC FAIL ;fail if OWP = 1
>
> SETB EA ;interrupts enable
> MOV B,#CLK_KHZ/100
> DJNZ B,$ ;delay
> MOV C,OWP ;read OWP (312 uS or more)
> JC RESOK ;OK if OWP = 1
>
> FAIL: CLR C
> SETB EA ;interrupts enable (if fail)
> RESOK: POP B
> RET
>
> ;Read/Write byte via 1-Wire bus
> ;Input: A - input byte
> ; R4 - CRC
> ;Out: A - output byte
> ; R4 - updated CRC
>
> TBYTE: PUSH B
> MOV B,#8 ;perform to read 8 bit
> TBYTE1: RRC A ;C <- bit
> LCALL TBIT ;transmit bit
> DJNZ B,TBYTE1 ;next bit
> RRC A ;A <- last bit
> POP B
> RET
>
> ;Read/Write bit via 1-Wire bus
> ;Input: C - input bit.
> ; R4 - CRC
> ;Out: C - output bit
> ; R4 - updated CRC
>
> TBIT: PUSH ACC
> CLR EA ;interrupts disable
> CLR OWP ;OWP <- 0 (begin of time slot)
> NOP ;delay to be sure...
> NOP ;that thermometr...
> NOP ;looks low level
> JC TB_1
> SJMP TB_0 ;if data bit = 0 then OWP <- 0
> TB_1: SETB OWP ;if data bit = 1 then OWP <- 1
> NOP ;delay for data setup
> TB_0: NOP
> NOP
> NOP
> NOP
> ; NOP ;10 MHz !
> ; NOP
> MOV C,OWP ;read port 15 uS later
> PUSH B ;save register B
> MOV B,#CLK_KHZ/706
> DJNZ B,$ ;delay to complete 60 uS slot
> POP B ;restore register B
> SETB OWP ;OWP <- 1, end of time slot
> SETB EA ;interrupts enable
>
> PUSH PSW ;update CRC, save C
> RLC A ;ACC.0 <- C
> XRL A,R4 ;~ACC.0 if CRC.0 = 1
RRC A ;ACC.0 ->> C
> MOV A,R4 ;A <- CRC
> JNC BCRC0
> XRL A,#18H ;update CRC
> BCRC0: RRC A ;shift CRC
> MOV R4,A ;CRC <- new value
> POP PSW ;restore C
>
> POP ACC
> RET
>
> ; Accesses to DALLAS DS1990A touch memory.
> ; Returns C=1 in case of valid code, else C=0.
> ; Out: ROMD (8 bytes)
>
> ACCESS90: CLR C ;indicate failure
> MOV A,AENTM ;check access enable timer
> JNZ RET90 ;exit if AENTM > 0
> MOV AENTM,#AENTMV ;reload access enable timer
>
> LCALL TRESET ;issue reset pulse
> JNC RET90 ;leave if no parts on bus
>
> CLR C ;indicate failure
> MOV A,TMATM ;check TM access timer
> JNZ DIS90 ;exit if TMATM > 0
>
> MOV A,#033H ;read ROM command
> LCALL TBYTE ;send command byte
>
> MOV R0,#ROMD ;init pointer
> MOV R1,#8 ;init counter
> MOV R4,#0 ;initialize CRC variable
>
> RDMORE: MOV A,#0FFH ;prepare to read a byte
> LCALL TBYTE ;read byte
> MOV @R0,A ;save byte
> INC R0 ;next address
> DJNZ R1,RDMORE ;repeat until finished
>
> MOV A,R4 ;get CRC value in ACC
> JZ CRC_OK ;jump if successful
> CLR C ;indicate failure
> SJMP RET90
>
> CRC_OK: LCALL CHKZ ;check code for zero
> JNC RET90 ;invalid code
>
> DIS90: MOV TMATM,#TMATMV
> RET90: RET ;return to caller
>
> ;Check TM code for zero:
>
> CHKZ: MOV R0,#ROMD ;init pointer
> MOV R1,#8 ;init counter
> NEXTZ: MOV A,@R0
> ADD A,#0FFH ;C = 1 if A>0
> JC OKZ
> INC R0 ;next address
> DJNZ R1,NEXTZ
> OKZ: RET
>
> ; I2C NVM memory 24C02 support:
> ;
> ; I2C - bus supported subroutines:
> ;
> ; I2C_WR - Write byte from A via I2C bus
> ; I2C_RD - Read byte to A via I2C bus
> ; I2C_LRD - Read last byte to A via I2C bus (no ASK)
> ; I2C_SUB - Send subaddress from R1 to I2C device
> ; I2C_SUBR - Send subaddress from R1 and perform read.
> ; I2C_STOP - Stop condition generation on I2C bus
> ;
> ; I2C slave address I2C_ADDR (0A0H for 24C02 A0,A1,A2=0)
> ; I2C data line SDA
> ; I2C clock line SCL
>
> ;Send subaddress to I2C device.
> ;Input: R1 - subaddress.
>
> I2C_SUB: MOV A,#I2C_ADDR ;I2C device address, write mode
> LCALL I2C_WR ;send device address
> MOV A,R1 ;subaddress
> LCALL I2C_WR ;send subaddress
> RET
>
> ;Send subaddress and perform read.
> ;Input: R1 - subaddress.
>
> I2C_SUBR: LCALL I2C_SUB ;send subaddress
> LCALL I2C_STOP ;stop
> MOV A,#I2C_ADDR+1 ;I2C device address, read mode
> LCALL I2C_WR ;send device address
> RET
>
> ;Send byte from A via I2C bus.
>
> I2C_WR: PUSH B
> MOV B,#9H ;bit counter load
> SETB C ;set C, for bit 9 = 1 (when ACK)
> LCALL SDA0 ;SDA 1 -> 0 - start
> I2CWR1: LCALL SCL0 ;SCL 1 -> 0
> RLC A
> JC OUTP1 ;jump if bit = 1
> LCALL SDA0 ;else SDA=0
> SJMP OUTP0
> OUTP1: LCALL SDA1 ;SDA=1, if bit = 1
> OUTP0: LCALL SCL1 ;SCL 0 -> 1
> DJNZ B,I2CWR1 ;loop
> POP B
> RET
>
> ;Read byte via I2C to A.
>
> I2C_RD: MOV A,#1H ;A init to receive 8 bit
> I2CRD1: LCALL SCL0 ;SCL 1 -> 0
> LCALL SDA1 ;SDA=1 - SDA line release
> LCALL SCL1 ;SCL 0 -> 1
> MOV C,SDA ;move bit from SDA line to C
> RLC A ;shift bit C into A
> JNC I2CRD1 ;loop until C = 1
> LCALL SCL0 ;SCL 1 -> 0
> LCALL SDA0 ;SDA=0 - ACK generation
> LCALL SCL1 ;SCL 0 -> 1
> RET
>
> ;Read byte via I2C to A without ASK
> ;(receive last byte).
>
> I2C_LRD: MOV A,#1H ;A init to receive 8 bit
> I2CLRD1: LCALL SCL0 ;SCL 1 -> 0
> LCALL SDA1 ;SDA=1 - SDA line release
> LCALL SCL1 ;SCL 0 -> 1
> MOV C,SDA ;move bit from SDA line to C
> RLC A ;shift bit C into A
> JNC I2CLRD1 ;loop until C = 1
> LCALL SCL0 ;SCL 1 -> 0
> LCALL SCL1 ;SCL 0 -> 1 when SDA=1: no ACK
> RET
>
> ;STOP condition generation:
>
> I2C_STOP: LCALL SCL0
> LCALL SDA0
> LCALL SCL1
> LCALL SDA1
> RET
>
> ;SDA and SCL lines control:
>
> SDA0: CLR SDA ;SDA 1/0
> RET
> SDA1: SETB SDA ;SDA 0/1
> RET
> SCL0: CLR SCL ;SCL 1/0
> RET
> SCL1: SETB SCL ;SCL 0/1
> RET
>
> ;EEPROM address map:
>
> ;00H - page not used
> ;08H - touch memory code 1
> ;10H - touch memory code 2
> ;...
>
> ;Save new key:
> ;NUM - key number (1..9)
>
> SAVE: MOV A,NUM
> MOV B,#8
> MUL AB ;NUM x 8
> MOV R1,A ;R1 <- subaddress
> LCALL I2C_SUB ;send subaddress
> MOV R1,#8 ;init counter
> MOV R0,#ROMD ;init pointer
> DOWR: MOV A,@R0
> LCALL I2C_WR ;send data
> INC R0
> DJNZ R1,DOWR
> LCALL I2C_STOP ;stop
> LCALL DEL15 ;delay 15mS to page write
> RET
>
> ;Check for member:
> ;Returns C=1 if code O.K.
>
> CHKMEM: MOV R2,#1 ;init key counter
>
> NEXT: MOV A,R2
> MOV B,#8
> MUL AB ;NUM x 8
> MOV R1,A ;R1 <- subaddress
> LCALL I2C_SUBR ;send subaddress and read mode
> MOV R1,#8 ;init counter
> MOV R0,#ROMD ;init pointer
>
> DORD: LCALL I2C_RD ;read data
> XRL A,@R0
> JNZ INVAL ;jump if invalid code
> INC R0 ;next address
> DJNZ R1,DORD
> LCALL I2C_LRD ;stop read
> LCALL I2C_STOP
> SETB C ;valid code, C <- 1
> RET
>
> INVAL: LCALL I2C_LRD ;stop read
> LCALL I2C_STOP
> INC R2 ;next key
> MOV A,R2
> CJNE A,#MAXK+1,NEXT
> CLR C ;invalid code, C <- 0
> RET
>
> ;Check for master:
>
> CHKMAS: MOV R1,#8 ;init counter
> MOV DPTR,#MK ;init pointer to ROM
> MOV R0,#ROMD+7 ;init pointer to RAM
> DOCM: CLR A
> MOVC A,@A+DPTR ;read ROM
> XRL A,@R0 ;ROM[DPTR] = RAM[R0] ?
> JNZ INVM ;jump if invalid code
> INC DPTR ;next ROM address
> DEC R0 ;next RAM address
> DJNZ R1,DOCM
> SETB C ;valid master code, C <- 1
> RET
>
> INVM: CLR C ;invalid master code, C <- 0
> RET
>
> ;Display support:
> ;Input: NUM = value
> ;if PROG = 0 display is blanked
> ;if PROG = 1 and BLINK = 1 display is blinking
>
> DISP: MOV A,#BLANK ;blank display if PROG = 0
> JNB PROG,IND
> MOV
-
- Если в квартире есть стационарный телефон Алексей Мусин(150 знак., 18.03.2005 07:59)
- Ответ: - nm5(18.03.2005 09:23)
- телефона нет и квартира съемная - nm5(18.03.2005 10:32)
- Стационарный телефон не поможет, скорее всего это соседи/местные/сами менты - dch(21.03.2005 02:15, )
- телефона нет и квартира съемная - nm5(18.03.2005 10:32)
- Ответ: - nm5(18.03.2005 09:23)
- Если в квартире есть стационарный телефон Алексей Мусин(150 знак., 18.03.2005 07:59)