Elektrotekno.com Ana Sayfa || Pic ve diğer işlemci ve denetleyiciler ile yapılmış devreler, projeler


asm içindeki kelimeleri Türkçeleştirme

Kayıt: 05 Mar 2008
Mesajlar: 68
Konum: balıkesir
Offline
electronickim
Tarih: 13 03 2012 19:47

arkadaşlar alarm devremi yaptım çok kararlı bir şekilde çalışıyor yakında fotoları ve dosyaları paylaşıcam ama önce türkçeleştirmek istiyorum. aşağıdaki asm kodun içindeki kelimeleri türkçe yapmaya çalışıyorum derlemede sorun olmuyor ama ekranda yazılar eksik çıkıyor. örneğin all off kısmını alarm kapalı yazdığımda ekranda sadece alarm ka yazısı çıkıyor. alarm acık yazdığımda alarm ac kelimesi ekranda görülebiliyor. change pın code kısmını sıfre degıstır olarak değiştirdim onda sorun olmuyor. kodda nerde hata yapıyorum yardımcı olurmusunuz türkçeleştirmek için.

;pıc16f877-4, 3.2768mhz, wdt off, por on, xtal xs

;config register bits
; cp1 cp0 dbg nıl wrt cpd lvp bor cp1 cp0 por wdt os1 os0
; 1 1 1 1 1 1 0 0 1 1 0 0 0 1
;n.b. logic 1/0 do not necessarily mean that the function is on/off
;respectively - refer to pıc '87 data sheet.

#defıne page0 bcf 0x03,5
#defıne page1 bsf 0x03,5

list p = pıc16f877, r=dec;
__confıg h'3f31'

ındf equ 0x00 ;page 0, 1, 2, 3
optıon_reg equ 0x01 ;page 1, 3
pcl equ 0x02 ;page 0, 1, 2, 3
status equ 0x03 ;page 0, 1, 2, 3
fsr equ 0x04 ;page 0, 1, 2, 3

porta equ 0x05 ;page 0
trısa equ 0x05 ;page 1
portb equ 0x06 ;page 0, 2
trısb equ 0x06 ;page 1, 3
portc equ 0x07 ;page 0
trısc equ 0x07 ;page 1
portd equ 0x08 ;page 0
trısd equ 0x08 ;page 1
porte equ 0x09 ;page 0
trıse equ 0x09 ;page 1

pclath equ 0x0a ;page 0, 1, 2, 3
ıntcon equ 0x0b ;page 0, 1, 2, 3

eedata equ 0x0c ;page 2
eecon1 equ 0x0c ;page 3

pır2 equ 0x0d ;page 0
eeadr equ 0x0d ;page 2
eecon2 equ 0x0d ;page 3

adcon1 equ 0x1f ;page 1

slowıt equ 0x20 ; pause counter
clkcnt equ 0x21
clksec equ 0x22
clkmın equ 0x23
clkhrs equ 0x24
loop equ 0x25
loopa equ 0x26
rslıne equ 0x27
store equ 0x28
store1 equ 0x29
store2 equ 0x2a
store3 equ 0x2b
zonesval equ 0x2c ; current val of zones status
alarmstatus equ 0x2d ; controls the following
; bit 0 buzzer
; bit 1 strobe
; bit 2 bell
; bit 3 -
; bit 4 panic flag
; bit 5 passive entry zone (just turns on buzzer when entered)
; bit 6 power interrupt flag
; bit 7 alarm on flag

swıtch1 equ 0x2e ; multiplex val for rows
swval equ 0x2f ; input val from rb0-rb3
col equ 0x30 ; column counter (inc in decimal)
row equ 0x31 ; row counter (inc as matrix val)
rownum equ 0x32 ; row counter (inc in decimal)
alarmzone equ 0x33 ; holds status of which zone triggered
keypress equ 0x34 ; value of key pressed keypad1
pın0 equ 0x35 ; 1st pin number val fırst keypad
pın1 equ 0x36 ; 2nd pin number val
pın2 equ 0x37 ; 3rd pin number val
pın3 equ 0x38 ; 4th pin number val

exıttıme equ 0x39 ; entry/exit delay
exıtzone equ 0x3a ; entry/exit zone
ınclzone equ 0x3b ; zones to be included in monitoring

belltıme equ 0x3c ; bell on time value in bcd mins
flash equ 0x3d ; flag for flashing buzzer led when zone incorrectly open during alarm setting
zonenormal equ 0x3e ; normal zone logic
engıneerset equ 0x3f ; flag to indicate if engıneer has been called
prevalarmzone equ 0x40 ; previous alarm condition register
entrydelay equ 0x41 ; counter for entry/exit delay
pın4 equ 0x42 ; 1st pin number val for 2nd keypad
pın5 equ 0x43 ; 2nd pin number val
pın6 equ 0x44 ; 3rd pin number val
pın7 equ 0x45 ; 4th pin number val
keypress2 equ 0x46 ; value of key pressed keypad2
entrytıme2 equ 0x47 ; entry time for keypad2
entrydelay2 equ 0x48 ; counter for keypad2 entry delay
clkcnt2 equ 0x49
stored equ 0x4a ; temp store for keypad2

count0 equ 0x50 ;lsb
count1 equ 0x51
count2 equ 0x52 ;msb
dıgıt1 equ 0x53 ;lsd
dıgıt2 equ 0x54
bıtcnt equ 0x5b
dıgcnt equ 0x5c
storex equ 0x60
storey equ 0x61

; locations up to 0x7f are available

;************************************************************
; bit definitions
;************************************************************

w equ 0
f equ 1
c equ 0
dc equ 1
z equ 2

rp0 equ 5 ;status reg
rp1 equ 6 ;status reg
gıe equ 7 ;ıntcon reg

rd equ 0 ;eecon1 reg eeprom read enable flag
wr equ 1 ;eecon1 reg eeprom write initiate flag
wren equ 2 ;eecon1 reg eeprom write enable flag

eepgd equ 7 ;eecon1 reg
eeıf equ 4 ;pır2 reg

buzzer equ 0
strobe equ 1
bell equ 2
panıc equ 4
rbıf equ 0

;............. data eeprom use

; 0-3 pın code
; 4 zones excluded
; 5 entry/exıt zone
; 6 entry/exıt delay
; 7 zones ıntruded (alarmzone)
; 8 alarm on/off & bell, buzzer, strobe status (alarmstatus)
; 9 bell on tıme (max 15 mıns)
; 10 normal zone status
; 11-14 2nd pın code
; 15 entry delay vıa keypad2

org 0x0004 ;ınterrupt vector address
goto gıeoff ;jump to interrupt routine on interrupt
org 0x0005 ;start of program memory

gıeoff bcf ıntcon,gıe ;turn off global interrupts
btfsc ıntcon,gıe
goto gıeoff
goto start

tablcd addwf pcl,f ;lcd initialisation table
retlw b'00110011' ;initialise lcd - first byte
retlw b'00110011' ;2nd byte (repeat of first)
retlw b'00110010' ;set for 4-bit operation
retlw b'00101100' ;set for 2 lines
retlw b'00000110' ;set entry mode to increment each address
retlw b'00001100' ;set display on, cursor off, blink off
retlw b'00000001' ;clear display
retlw b'00000010' ;return home, cursor & ram to zero
;end inititalisation table

alloff addwf pcl,f
retlw 'a'
retlw 'l'
retlw 'l'
retlw ' '
retlw 'o'
retlw 'f'
retlw 'f'
retlw ' '

messagon addwf pcl,f
retlw 'a'
retlw 'l'
retlw 'a'
retlw 'r'
retlw 'm'
retlw ' '
retlw 'o'
retlw 'n'
retlw ' '

messag2 addwf pcl,f
retlw ' '
retlw ' '
retlw 'e'
retlw 'n'
retlw 't'
retlw 'r'
retlw 'y'
retlw ' '

chkval addwf pcl,f
retlw b'01011001' ;59 secs max
retlw b'01011001' ;59 mins max
retlw b'00100011' ;23 hours max

value addwf pcl,f ;lookup table for key allocation
retlw '1'
retlw '2'
retlw '3'
retlw 'a'
retlw '4'
retlw '5'
retlw '6'
retlw 'b'
retlw '7'
retlw '8'
retlw '9'
retlw 'c'
retlw '-'
retlw '0'
retlw 'e'
retlw 'd'

bıtvalue addwf pcl,f ;lookup table for decimal to bit conversion
retlw .0
retlw .1
retlw .2
retlw .4
retlw .8
retlw .16
retlw .32
retlw .64
retlw .128

pıncode addwf pcl,f ; change pin code message
retlw 'c'
retlw 'h'
retlw 'a'
retlw 'n'
retlw 'g'
retlw 'e'
retlw ' '
retlw 'p'
retlw 'ı'
retlw 'n'
retlw ' '
retlw 'c'
retlw 'o'
retlw 'd'
retlw 'e'
retlw ' '

pın2msg addwf pcl,f ; change 2nd pin code message
retlw 's'
retlw 'e'
retlw 't'
retlw ' '
retlw '2'
retlw 'n'
retlw 'd'
retlw ' '
retlw 'p'
retlw 'ı'
retlw 'n'
retlw ' '
retlw 'c'
retlw 'o'
retlw 'd'
retlw 'e'

entrytıme addwf pcl,f ; change entry/exıt time message
retlw 's'
retlw 'e'
retlw 't'
retlw ' '
retlw 'ı'
retlw 'n'
retlw '/'
retlw 'o'
retlw 'u'
retlw 't'
retlw ' '
retlw 't'
retlw 'ı'
retlw 'm'
retlw 'e'
retlw ' '

belltımemsg addwf pcl,f ; change entry/exıt time message
retlw 's'
retlw 'e'
retlw 't'
retlw ' '
retlw 'b'
retlw 'e'
retlw 'l'
retlw 'l'
retlw ' '
retlw 'o'
retlw 'n'
retlw ' '
retlw 't'
retlw 'ı'
retlw 'm'
retlw 'e'

entryzone addwf pcl,f ; set entry/exıt zone message
retlw 's'
retlw 'e'
retlw 't'
retlw ' '
retlw 'ı'
retlw 'n'
retlw '/'
retlw 'o'
retlw 'u'
retlw 't'
retlw ' '
retlw 'z'
retlw 'o'
retlw 'n'
retlw 'e'
retlw ' '

modemsg addwf pcl,f ; mode message
retlw 's'
retlw 'e'
retlw 'l'
retlw 'e'
retlw 'c'
retlw 't'
retlw ' '
retlw 'm'
retlw 'o'
retlw 'd'
retlw 'e'
retlw ' '
retlw ' '
retlw ' '
retlw ' '
retlw ' '

watchmsg addwf pcl,f ; zones to be watched message
retlw 's'
retlw 'e'
retlw 't'
retlw ' '
retlw 'w'
retlw 'a'
retlw 't'
retlw 'c'
retlw 'h'
retlw ' '
retlw 'z'
retlw 'o'
retlw 'n'
retlw 'e'
retlw 's'
retlw ' '

openzone addwf pcl,f ; zones incorrectly open when alarm is being set
retlw 'c'
retlw 'h'
retlw 'e'
retlw 'c'
retlw 'k'
retlw ' '
retlw 'o'
retlw 'p'
retlw 'e'
retlw 'n'
retlw ' '
retlw 'z'
retlw 'o'
retlw 'n'
retlw 'e'
retlw 's'

zonelogıc addwf pcl,f ; assess zone logic message (i.e normally open or normally closed)
retlw 'a'
retlw 'u'
retlw 't'
retlw 'o'
retlw ' '
retlw 'z'
retlw 'o'
retlw 'n'
retlw 'e'
retlw ' '
retlw 'a'
retlw 's'
retlw 's'
retlw 'e'
retlw 's'
retlw 's'

showlogıc addwf pcl,f ; assess zone logic message (i.e normally open or normally closed)
retlw 'n'
retlw 'o'
retlw 'r'
retlw 'm'
retlw ' '
retlw 'z'
retlw 'o'
retlw 'n'
retlw 'e'
retlw ' '
retlw 'l'
retlw 'o'
retlw 'g'
retlw 'ı'
retlw 'c'
retlw ' '

passıvemsg addwf pcl,f ; passive alarm message
retlw 'm'
retlw 'o'
retlw 'n'
retlw 'ı'
retlw 't'
retlw 'o'
retlw 'r'
retlw ' '

start bcf status,rp0
bcf status,rp1
clrf porta
clrf portb
clrf portc
clrf portd
clrf porte
page1
movlw b'11011111' ;rb0-rb4, rb6-rb7 as input, rb5 as output
movwf trısb
movlw b'00001111' ;rc0-rc3 as input, rc4-rc7 as output
movwf trısc
movlw .255
movwf trısd ;portd as input
clrf trıse ;porte as output
movlw b'00000111' ;port a/e as digital
movwf adcon1 ;
movlw b'11000000' ;ra0-ra5 as outputs
movwf trısa

movlw b'00000110' ;timer 1128 (1/25th sec)
movwf optıon_reg
page0
clrf ıntcon
call pausıt ;1/5 sec delay

lcdset clrf loop ;clr lcd set-up loop
clrf rslıne ;clear rs line for instruction send
lcdst2 movf loop,w ;get table address
call tablcd ;get set-up instruction
call lcdout ;perform it
incf loop,f ;inc loop
btfss loop,3 ;has last lcd set-up instruction now been done?
goto lcdst2 ;no
call pausıt ;1/5 sec delay

clrf engıneerset
bsf alarmstatus,6 ; set power interruption flag

call keypad1 ; is engıneer code to be entered following power-up
movf keypress,w ; with key 'd' pressed?
xorlw 'd'
btfss status,z
goto setclk ; no

clrf alarmzone
clrf alarmstatus
bsf engıneerset,0
bcf alarmstatus,6 ; clear power interruption flag

movlw b'10000001' ; default set ınclzone for zones 1 & 8
movwf store1
movlw .4
call setprm

movlw b'00000001' ; default set entry/exit zone
movwf store1
movlw .5
call setprm

movlw .30 ; default set exıttıme to 30 secs in binary
movwf store1
movlw .6
call setprm

clrf store1 ; default clear ıntruded status
movlw .7
call setprm
clrf porte

clrf store1 ; default clear alarmstatus (bell etc)
bcf store1,bell
movlw .8
call setprm

movlw b'00010101' ; default set bell switch-off time to 15 mins in bcd
movwf store1
movlw .9
call setprm

movlw b'00000000' ; default set for "normal" zone status - all open
movwf store1
movlw .10
call setprm

movlw .30 ; default set entrytıme to 30 secs in binary for keypad2
movwf store1
movlw .15
call setprm

call engıneer ; yes, set engıneer entry code and reset all defaults

setclk clrf clksec ;clear seconds counter
clrf clkmın ;clear minutes counter
clrf clkhrs ;clear hours counter
clrf prevalarmzone
clrf entrydelay
clrf entrydelay2

movlw .25 ;initial basic clkcnt val for secs timing
movwf clkcnt

movlw .0 ; recall pın code
call prmget
movwf pın0
movlw .1
call prmget
movwf pın1
movlw .2
call prmget
movwf pın2
movlw .3
call prmget
movwf pın3

movlw .4 ; recall ıncluded/excluded zones
call prmget
movwf ınclzone
bsf ınclzone,7 ; ensure bit 7 (1st panıc zone) is always on

movlw .5 ; recall entry/exıt zone
call prmget
movwf exıtzone
movlw .6 ; recall entry/exıt tıme
call prmget
movwf exıttıme
movlw .7 ; recall alarmzone status
call prmget
movwf alarmzone
movlw .8 ; recall alarmstatus status
call prmget
movwf alarmstatus ; and activate buzzer/strobe if needed (but not bell)
andlw b'00000011'
movwf porte
movlw .9 ; recall bell on tıme
call prmget
movwf belltıme
movlw .10 ; recall "normal zone status
call prmget
movwf zonenormal

movlw .11 ; recall pın code 2
call prmget
movwf pın4
movlw .12
call prmget
movwf pın5
movlw .13
call prmget
movwf pın6
movlw .14
call prmget
movwf pın7

movlw .15 ; recall entry tıme for keypad2
call prmget
movwf entrytıme2

btfss alarmstatus,7 ; is alarm on?
goto ıtsoff
call checkzone2
bsf alarmstatus,6 ; set power interruption flag
goto maın

ıtsoff call alarmoff ; show alarm off message
btfsc engıneerset,0 ; has engıneer been called?
goto maın ;yes

call lcd21 ;set address for line 1 cell 1
bsf rslıne,4 ;set rs for data send
movlw 'p'
call lcdout
movlw 'o'
call lcdout
movlw 'w'
call lcdout
movlw 'e'
call lcdout
movlw 'r'
call lcdout
movlw ' '
call lcdout
movlw 'e'
call lcdout
movlw 'r'
call lcdout
movlw 'r'
call lcdout
movlw 'o'
call lcdout
movlw 'r'
call lcdout
clrf engıneerset ; clear engıneer flag

;............................ end of setup

maın call checkmode
call pınentry2
movf entrydelay2,w ; has entry2 delay timed out?
btfss status,z
call contınueentry2 ; no, continue countdown of entry2
goto maın

alarmıson btfss alarmstatus,7 ; is alarm on ?
return ; no
call monıtor ; get current status of zones 1-8
call checkzone ; compare current and preset zones status
call setbells
call clkın
return

passıvealarm
call monıtor ; get current status of zones 1-8
call checkzone ; compare current and preset zones status
movf zonesval,w
btfss status,z
goto pas1
bcf porte,buzzer
goto pas2
pas1 bsf porte,buzzer
pas2 call lcd21 ;set address for line 1 cell 1
bsf rslıne,4 ;set rs for data send
movf zonesval,w
movwf store1 ; store ıntruded status
call showzone
return

;******* check mode

checkmode call keypad1 ; is key pressed?
movf keypress,w
btfsc status,z
return ; no, so return

checkm2 call waıtkeypress
movf keypress,w ; is keypress = pin number?
xorwf pın0,w
btfss status,z
return

call waıtkeyrelease
call waıtkeypress
movf keypress,w ; is keypress = pin number?
xorwf pın1,w
btfss status,z
return

call waıtkeyrelease
call waıtkeypress
movf keypress,w ; is keypress = pin number?
xorwf pın2,w
btfss status,z
return

call waıtkeyrelease
call waıtkeypress
movf keypress,w ; is keypress = pin number?
xorwf pın3,w
btfss status,z
return

goto amendmode ; yes

;*********** amend mode **********

amendmode clrf porte ; turn off bell, buzzer, strobe
btfss alarmstatus,7 ; is alarm already in alarm mode?
goto amend0 ; no
goto amend2

amend0 call lcd1 ;set address for line 1 cell 1
bsf rslıne,4 ;set rs for data send
clrf loop ;clear loop
bsf rslıne,4 ;set rs for data send
amend1 movf loop,w ;get table address
call modemsg ;get message letter
call lcdout ;show it
incf loop,f ;inc loop
btfss loop,4 ;has last lcd letter been sent?
goto amend1 ;no
call clrlıne2

amend2 clrf alarmstatus
clrf alarmzone
clrf prevalarmzone

call waıtkeyrelease
call waıtkeypress

movf keypress,w ; is keypress = '0' - alarm on?
xorlw '0'
btfsc status,z
goto alarmon ; yes, so set alarm on and exit

check12 movf keypress,w ; is keypress = '-' - cancel?
xorlw '-'
btfsc status,z
goto alarmoff ; general return to normal off status

check0 movf keypress,w ; is keypress = '1' - change pın code?
xorlw '1'
btfss status,z
goto check1
call engıneer
goto amend0

check1 movf keypress,w ; is keypress = '2' - change entry/exıt time?
xorlw '2'
btfss status,z
goto check2
call changeentry
goto amend0

check2 movf keypress,w ; is keypress = '3' - change entry/exıt zone?
xorlw '3'
btfss status,z
goto check3
call setentry
goto amend0

check3 movf keypress,w ; is keypress = '4' - select zones to monitored?
xorlw '4'
btfss status,z
goto check4
call setmonıtor
goto amend0

check4 movf keypress,w ; is keypress = '5' - select bell on time (max 15 mins)
xorlw '5'
btfss status,z
goto check5
call setbelltıme
goto amend0

check5 movf keypress,w ; is keypress = '6' - assess normal zone logic
xorlw '6'
btfss status,z
goto check6
call assesslogıc
goto amend0

check6 movf keypress,w ; is keypress = '7' - preset normal zone logic
xorlw '7'
btfss status,z
goto check7
call presetlogıc
goto amend0

check7 movf keypress,w ; is keypress = '8' - set 2nd pin code
xorlw '8'
btfss status,z
goto check8
call pıncode2
goto amend0

check8 movf keypress,w ; is keypress = '9' - change entry time for keypad2 ?
xorlw '9'
btfss status,z
goto check14
call changeentry2
goto amend0

check14 movf keypress,w ; is keypress = '.' (coded 'e') - buzzer only monitor of entries
xorlw 'e'
btfss status,z
goto check15
goto setpassıve

check15
goto amend2


; ******** passıve mode

setpassıve call lcd1 ;set lcd for line 1, cell 1
bsf rslıne,4 ;set lcd rs line high

clrf loop ;clear loop
setp2 movf loop,w ;get table address
call passıvemsg ;get message letter
call lcdout ;show it
incf loop,f ;inc loop
btfss loop,3 ;has last lcd letter been sent?
goto setp2 ;no
movlw 'm'
call lcdout
movlw '0'
call lcdout
movlw 'd'
call lcdout
movlw 'e'
call lcdout
bsf alarmstatus,5
return

;********* change entry/exıt tıme

changeentry call lcd1 ;set lcd for line 1, cell 1
bsf rslıne,4 ;set lcd rs line high

clrf loop ;clear loop
ent2 movf loop,w ;get table address
call entrytıme ;get message letter
call lcdout ;show it
incf loop,f ;inc loop
btfss loop,4 ;has last lcd letter been sent?
goto ent2 ;no

call clrlıne2
call lcd23 ;set lcd for line 2, cell 3
bsf rslıne,4 ;set lcd rs line high
movlw ' '
call lcdout
movlw 'p'
call lcdout
movlw 'r'
call lcdout
movlw 'e'
call lcdout
movlw 'v'
call lcdout
movlw ' '
call lcdout
movf exıttıme,w
movwf count0
call bın2dec

movf dıgıt2,w
addlw .48
call lcdout
movf dıgıt1,w
addlw .48
call lcdout

call lcd21 ;set lcd for line 2, cell 1
bsf rslıne,4 ;set lcd rs line high

call waıtkeyrelease
ent3 call waıtkeypress ; get first value (tens)
movf keypress,w ; is keypress = 12 - cancel?
xorlw '-'
btfsc status,z
return ; yes

btfsc keypress,6 ; is it >= 'a'?
goto ent3 ; yes, so try again

movf keypress,w
andlw b'00001111'

movwf count1
movwf count2
movf keypress,w
call lcdout

call waıtkeyrelease
ent4 call waıtkeypress ; get 2nd val (units)
movf keypress,w ; is keypress = 12 - cancel?
xorlw '-'
btfsc status,z
return ; yes

btfsc keypress,6 ; is it >= 'a'?
goto ent4 ; yes, so try again

movf keypress,w
andlw b'00001111'
movwf count0
addwf count1,w ; is total = 0?
btfsc status,z
goto ent4 ; yes, so try again
movf keypress,w
call lcdout

ent5 call waıtkeyrelease
call waıtkeypress
movf keypress,w
xorlw 'd' ; is key = 15? - completion code number
btfsc status,z
goto ent6 ; yes

movf keypress,w
xorlw '-' ; is key = 12? - error in number so start again
btfss status,z
goto ent5 ; no
goto changeentry ; yes

ent6 call waıtkeyrelease
bcf status,c
rlf count1,f ; convert decimal to binary
rlf count1,f
rlf count1,w
addwf count2,w
addwf count2,w
addwf count0,w
movwf exıttıme
movf exıttıme,w
movwf store1
movlw .6
call setprm
call storıt
return

;********* monıtor zones *********

monıtor swapf portc,w ; get rc0-rc3, store it as ms nibble
andlw b'11110000'
movwf zonesval
movf portd,w ; get rd0-rd3, store it as ls nibble
andlw b'00001111'
iorwf zonesval,f
return

; ********* compare current and preset zones status

checkzone movf entrydelay2,w ; has entry2 delay timed out?
btfss status,z
call contınueentry2 ; no, continue countdown

movf zonesval,w ; get current zones val
xorwf zonenormal,w ; xor with normal zones status
btfss status,z ; has a zone status been changed?
goto zch2 ; yes
movf alarmzone,w ; have any zones been triggered?
btfsc status,z ;
return ; no

zch2 movwf zonesval ; yes
andwf ınclzone,w ; is it a required zone?
btfsc status,z
return ; no

movwf zonesval
btfsc alarmstatus,5 ; yes, is alarm in passive status (just sets buzzer)?
return ; yes

iorwf alarmzone,w ; no, or answer with previous zones triggered value
movwf alarmzone

btfsc alarmstatus,strobe ; has alarm already been triggered?
goto zoneb ; yes

movf alarmzone,w
andwf exıtzone,w ; has entry zone been triggered?
btfsc status,z
goto zoneb ; no

movf entrydelay,w ; yes, has entry delay timed out?
btfsc status,z
goto zoneb ; yes

bsf alarmstatus,buzzer ; no so continue countdown
call contınueentry ;

call lcd21 ;set address for line 1 cell 1
bsf rslıne,4 ;set rs for data send
movlw 'e'
call lcdout
movlw 'n'
call lcdout
movlw 't'
call lcdout
movlw 'r'
call lcdout
movlw 'y'
call lcdout
return

zoneb movf alarmzone,w
xorwf prevalarmzone,w ; is it same as previous alarm zone setting?
btfsc status,z
return ; yes

movf alarmzone,w
movwf prevalarmzone

movwf store1 ; store ıntruded status
movlw .7
call setprm

checkzone2 ; called also from power up entry
call lcd1 ;set address for line 1 cell 1
bsf rslıne,4 ;set rs for data send
movf alarmzone,w
movwf store1 ; store ıntruded status
call showzone

clrf loop ;clear loop
bsf rslıne,4 ;set rs for data send
btfss alarmstatus,panıc
goto lcdms3 ; ...... trıg
movlw 'p'
call lcdout

lcdms3 movf loop,w ;get table address
call messag2 ;get entered message letter
call lcdout ;show it
incf loop,f ;inc loop
btfss loop,3 ;has last lcd letter been sent?
goto lcdms3 ;no

trıg btfss alarmstatus,strobe ; has alarm already been triggered?
bsf alarmstatus,bell ; no, so trigger bell
bsf alarmstatus,buzzer
bsf alarmstatus,strobe

movf alarmstatus,w ; store alarmstatus (but with bell off) to eeprom
movwf store1
bcf store1,bell
movlw .8
call setprm
return

; ****** sets bell buzzer strobe with alarmstatus value

setbells movf alarmstatus,w
andlw b'00000111'
movwf porte
return

;********* clock updatıng

clkın btfss alarmstatus,strobe ; clock only used if strobe active
return ; allowing elapsed time since first zone triggered to be shown
btfss ıntcon,2 ; has timer rollover occurred?
return ; no

bcf ıntcon,2 ; yes, clear timer flag
decfsz clkcnt,f ; increment clock routine. ıs it = 0?
return ; no

clkadd movlw .25 ; reset start value of clkcnt
movwf clkcnt

secclk movlw clksec
movwf fsr
movlw .3
movwf loopa

addclk incf ındf,f ;inc units
movlw .6
addwf ındf,w ;if 6 is added is there a digit carry?
btfss status,dc
goto chk15 ;no
movwf ındf ;yes
movlw .160
addwf ındf,w ;if 160 is added is there a carry
btfss status,c ;(adding 160 checks if tens of units = 6)
goto chk15 ;no
clrf ındf ;yes
incf fsr,f
decfsz loopa,f
goto addclk

chk15 movf clkmın,w ; has bell been on for set number of mins?
xorwf belltıme,w ; mins in bcd (max 20)
btfsc status,z
bcf alarmstatus,bell

clkshw call lcd21 ;set address for line 1 cell 9
bsf rslıne,4 ;set rs for data send
movf clkhrs,w ;get hrs
call lcdfrm ;format and send it
movlw ' ' ;insert colon
call lcdout
movf clkmın,w ;get mins
call lcdfrm
movlw '.' ;insert colon
call lcdout
movf clksec,w ;get secs
call lcdfrm
btfss alarmstatus,6 ; has there been a power interruption?
return ;no

movlw ' ' ; yes
call lcdout
movlw 'p'
call lcdout
movlw 's'
call lcdout
movlw 'u'
call lcdout
movlw ' '
call lcdout
movlw 'e'
call lcdout
movlw 'r'
call lcdout
movlw 'r'
call lcdout
return

;..........get keypad 1 val routıne........

keypad1 clrf keypress
btfss ıntcon,rbıf ; has panic been pushed
goto kp2 ; no
call panıcset

kp2 btfsc alarmstatus,7 ; is alarm on?
call alarmıson ; yes
btfsc alarmstatus,5 ; is alarm on?
call passıvealarm ; yes

; goto keypad2

movlw b'00001111'
movwf portc
movwf store
nop ;pause to allow portc to stabilise
comf portb,w ;get & invert portb
andlw b'00001111' ;isolate bits 0-3
btfsc status,z ;is result not zero (keys pressed)?
return ;no, so return to main prog

movlw b'10000000' ;yes, a key is pressed so get it
movwf swıtch1 ;initial val for rc4-7
movlw .3 ;initial val for col
movwf col
clrf row ;initial val for row

getıt comf swıtch1,w ;get and invert val for portc
iorwf store,w
movwf portc ;output to portc
nop ;pause to allow portc to stabilise
comf portb,w ;get and invert val from portb
andlw .15 ;isolate bits 0-3
btfss status,z ;is it zero?
goto get2 ;no, so goto analysis routine
decf col,f ;dec col val
bcf status,c ;clear carry flag
rrf swıtch1,f ;divide rc7-4 val by 2
movf swıtch1,w ;
andlw b'11110000'
btfss status,c ;is it zero?
goto getıt ;no, so continue loop
return ;yes, so return to main program

get2 movwf swval ;store portb val
clrf row ;clear row count
clrf rownum ;clear row number count

get3 rrf swval,f ;rotate right portb store val
btfsc status,c ;is carry flag set?
goto sumıt ;yes so key pressed, go & finish answer
movlw .4
addwf row,f ;add matrix val to row count
incf rownum,f ;inc row number count
btfss rownum,2
goto get3

sumıt movf row,w ;sum up results to single answer
addwf col,w ;add row to col (total of 0-15)
call value
movwf keypress ; store result into keypress
call debounce
return ;return to main program

;********* set engıneer's pın code

engıneer call lcd1 ;set lcd for line 1, cell 1
bsf rslıne,4 ;set lcd rs line high

clrf loop ;clear loop
eng2 movf loop,w ;get table address
call pıncode ;get message letter
call lcdout ;show it
incf loop,f ;inc loop
btfss loop,4 ;has last lcd letter been sent?
goto eng2 ;no

call clrlıne2
call lcd21 ;set lcd for line 2, cell 1
bsf rslıne,4 ;set lcd rs line high

movlw pın0
movwf fsr
clrf loop

eng3 call waıtkeyrelease
call waıtkeypress

movf keypress,w
xorlw '-' ; is key = 12? - error in number so start again
btfss status,z ; ... c
goto eng4 ; ... engıneer
movf loop,w ; is loop = 0?
btfss status,z
goto engıneer ; no, so clear and continue
return ; yes, so exit

eng4 movf keypress,w ; is val greater than 11?
xorlw 'e' ; is it = 14?
btfsc status,z
goto eng3 ; yes, so try again
movf keypress,w ; is val greater than 11?
xorlw 'd' ; is it = 15?
btfsc status,z
goto eng3 ; yes, so try again

movf keypress,w
movwf ındf ; no, store it into pınx and eeprom
movwf store1 ; and send to lcd
movf loop,w
call setprm
movf keypress,w
call lcdout
incf fsr,f
incf loop,f
btfss loop,2
goto eng3

eng7 call waıtkeyrelease
call waıtkeypress
movf keypress,w
xorlw 'd' ; is key = 16? - completion code number
btfsc status,z
goto eng8 ; yes

movf keypress,w
xorlw '-' ; is key = 12? - error in number so start again
btfss status,z
goto eng7 ; no
goto engıneer

eng8 call storıt
call waıtkeyrelease
return

; ******* wrıte data to eeprom routıne modified for pıc16f87x devices ********
;according to data sheet ds30292a page 43

;this routine is entered with w holding
;the eeprom byte address at which data
;is to be stored. the data to be stored
;is held in store1.
setprm bsf status,rp1 ;set for page 2
bcf status,rp0
movwf eeadr ;copy w into eeadr to set eeprom address
bcf status,rp1 ;set for page 0
movf store1,w ;get data value from store1 and hold in w
bsf status,rp1 ;set for page 2
movwf eedata ;copy w into eeprom data byte register
bsf status,rp0 ;set for page 3
bcf eecon1,eepgd ;point to data memory
bsf eecon1,wren ;enable write flag

manual movlw 0x55 ;these lines cause the action required by
movwf eecon2 ;by the eeprom to store the data in eedata
movlw 0xaa ;at the address held by eeadr.
movwf eecon2
bsf eecon1,wr ;set the ``perform write'' flag
bcf status,rp1 ;set for page 0
bcf status,rp0

chkwrt btfss pır2,eeıf ;wait until bit 4 of pır2 is set
goto chkwrt
bcf pır2,eeıf ;clear bit 4 of pır2
return


;******** read data from eeprom routıne modified for pıc16f87x devices ****
; according to data sheet ds30292a page 43

;this routine is entered with w holding
;the eeprom byte address to be read.
prmget bsf status,rp1 ;set for page 2
bcf status,rp0
movwf eeadr ;copy w into eeadr to set eeprom address
bsf status,rp0 ;set for page 3
bcf eecon1,eepgd ;point to data memory
bsf eecon1,rd ;enable read flag
bcf status,rp0 ;set for page 2
movf eedata,w ;read eeprom data now in eedata into w
bcf status,rp1 ;set for page 0
return

;******** lcd routınes **********

lcd1 movlw b'10000000'
goto lcdlın
lcd5 movlw b'10000100'
goto lcdlın
lcd21 movlw b'11000000'
goto lcdlın
lcd23 movlw b'11000011'

lcdlın bcf rslıne,4

lcdout movwf store
movlw .50
movwf loopa
delay decfsz loopa,f
goto delay
call sendıt
sendıt swapf store,f
movf store,w
andlw .15
iorwf rslıne,w
movwf porta
bsf porta,5
bcf porta,5
return

lcdfrm movwf store2 ;split & format decimal byte for lcd
swapf store2,w ;get tens nibble
andlw .15
iorlw .48 ;ascıı convert it
call lcdout ;send it
movf store2,w ;get units
andlw .15
iorlw .48 ;ascıı convert it
call lcdout
return

;.............

pausıt movlw .10
movwf slowıt
bcf ıntcon,2
pause btfss ıntcon,2
goto pause
bcf ıntcon,2
decfsz slowıt,f
goto pause
return

debounce bsf porte,0 ; briefly sound buzzer
clrf slowıt
dbx decfsz slowıt,f
goto dbx
dba decfsz slowıt,f
goto dba
dbb decfsz slowıt,f
goto dbb
dbc decfsz slowıt,f
goto dbc
dbd decfsz slowıt,f
goto dbd

btfss porte,1 ; has alarm been triggered?
bcf porte,0 ; no, so turn off buzzer
return

;.............

alarmoff clrf porte
call clrlıne1
call lcd1 ;set address for line 1 cell 1
bsf rslıne,4 ;set rs for data send
clrf loop ;clear loop
bsf rslıne,4 ;set rs for data send
aloff2 movf loop,w ;get table address
call alloff ;get message letter
call lcdout ;show it
incf loop,f ;inc loop
btfss loop,3 ;has last lcd letter been sent?
goto aloff2 ;no
call clrlıne2
call pausıt
clrf alarmzone
clrf alarmstatus
clrf prevalarmzone
clrf entrydelay
clrf zonesval
clrf clksec
clrf clkmın
clrf clkhrs

clrf store1 ; reset alarmzone status to eeprom
movlw .7
call setprm
clrf store1 ; reset alarmstatus status to eeprom
movlw .8
call setprm
return

;******** set alarm ınto actıve mode ********

alarmon bsf porte,buzzer ; turn on buzzer
call monıtor ; get zones status
comf exıtzone,w ; invert exit zone
andwf zonesval,w ; and inverted exit zone with zones status to exclude exit zone setting
movwf storex ; store it into storex (new variable that needs equating at start)
comf exıtzone,w ; invert exit zone
andwf zonenormal,w ; and it with zonenormal to exclude its setting
xorwf storex,w ; compare current zones value with normal zones status, but ignoring entry zone
btfsc status,z ; is a zone incorrectly open?
goto alon1 ; no
movwf store3 ; yes, set value for show zones at setal

call keypad1 ; check if abort being called
movf keypress,w ; is there a keypress?
btfsc status,z
goto setal ; no

movf keypress,w ; yes
xorlw '-' ; is key = 12 - abort?
btfsc status,z
goto alarmoff ; yes

setal call lcd1 ;set address for line 1 cell 1
bsf rslıne,4 ;set rs for data send
clrf loop ;clear loop
bsf rslıne,4 ;set rs for data send
alon0 movf loop,w ;get table address
call openzone ;get message letter
call lcdout ;show it
incf loop,f ;inc loop
btfss loop,4 ;has last lcd letter been sent?
goto alon0 ;no

call lcd21 ; set lcd for line 2, cell 1
bsf rslıne,4 ; set lcd rs line high
movf store3,w ; yes, so show zones
movwf store1
call showzone
incf flash,f ; beep buzzer and flash its led
bcf porte,0
btfss flash,0
bsf porte,0
call pausıt
goto alarmon

alon1 call clrlıne1
call lcd1 ;set address for line 1 cell 1
bsf rslıne,4 ;set rs for data send
clrf loop ;clear loop
bsf rslıne,4 ;set rs for data send
alon2 movf loop,w ;get table address
call messagon ;get message letter
call lcdout ;show it
incf loop,f ;inc loop
btfss loop,3 ;has last lcd letter been sent?
goto alon2 ;no
clrf alarmzone
clrf prevalarmzone
call clrlıne2
goto delayexıt

;............

delayexıt
movf exıttıme,w
movwf clksec

bsf porte,buzzer ; set buzzer on
movf clksec,w
movwf count0
call bın2dec

call lcd21 ;set address for line 2 cell 1
bsf rslıne,4 ;set rs for data send
movlw 'ı'
call lcdout
movlw 'n'
call lcdout
movlw ' '
call lcdout

movf dıgıt2,w
addlw .48
call lcdout
movf dıgıt1,w
addlw .48
call lcdout

movlw ' '
call lcdout
movlw 's'
call lcdout
movlw 'e'
call lcdout
movlw 'c'
call lcdout
movlw 's'
call lcdout

movlw .25 ; reset start value of clkcnt
movwf clkcnt ; 23 used because of debounce call in keypad1 routine

bcf ıntcon,2 ; yes, clear timer flag
exıt2 btfss ıntcon,2 ; has timer rollover occurred?
goto exıt2 ; no
bcf ıntcon,2 ; yes, clear timer flag

call keypad1 ; is abort being called?
movf keypress,w
xorlw '-'
btfsc status,z
goto alarmoff ; yes

bsf porte,buzzer ; keep buzzer on
decfsz clkcnt,f ; increment clock routine. ıs it = 0?
goto exıt2 ; no

movlw .25 ; reset start value of clkcnt
movwf clkcnt ; 23 used because of debounce call in keypad1 routine
decf clksec,f ; inc secs count
movf clksec,w
movwf count0
clrf count1
clrf count2
call bın2dec

call lcd23 ;set address for line 2 cell 1
bsf rslıne,4 ;set rs for data send
movf clksec,w

movf dıgıt2,w
addlw .48
call lcdout
movf dıgıt1,w
addlw .48
call lcdout

movf clksec,w ; is it equal to exıttıme?
btfss status,z
goto exıt2 ; no

bcf porte,buzzer
call clrlıne2
clrf clksec
clrf clkmın
clrf clkhrs
clrf store1 ; reset alarmzone status to eeprom
movlw .7
call setprm
movlw b'10000000' ; bit 7 = alarm on flag
movwf alarmstatus
movwf store1 ; reset alarmstatus status to eeprom
movlw .8
call setprm
movf exıttıme,w
movwf entrydelay
movlw .25 ; reset start value of clkcnt
movwf clkcnt ;
bcf portb,5 ; turn off keypad2 entry enable
return

;*********** binary to decimal modified from peter hemsley's code

bın2dec clrf dıgıt1
clrf dıgıt2

movlw .8 ;8 bits to do
movwf bıtcnt

bitlp rlf count0,f ;shift msb into carry
movlw dıgıt1
movwf fsr ;pointer to digits
movlw .2 ;2 digits to do
movwf dıgcnt
adjlp rlf ındf,f ;shift digit 1 bit left
movlw .10
subwf ındf, w
skpnc
movwf ındf

incf fsr,f ;next digit
decfsz dıgcnt,f
goto adjlp
decfsz bıtcnt,f ;next bit
goto bitlp
return

;********* set entry/exıt zone

setentry call lcd1 ;set lcd for line 1, cell 1
bsf rslıne,4 ;set lcd rs line high

clrf loop ;clear loop
ext2 movf loop,w ;get table address
call entryzone ;get message letter
call lcdout ;show it
incf loop,f ;inc loop
btfss loop,4 ;has last lcd letter been sent?
goto ext2 ;no
movf exıtzone,w
movwf store3

call clrlıne2

ext2a call lcd21 ;set lcd for line 2, cell 1
bsf rslıne,4 ;set lcd rs line high
movf store3,w
movwf store1
call showzone
movlw ' '
call lcdout
movlw ' '
call lcdout
movlw ' '
call lcdout
movlw 'm'
call lcdout
movlw 'a'
call lcdout
movlw 'x'
call lcdout
movlw ' '
call lcdout
movlw '6'
call lcdout

call waıtkeyrelease
ext3 call waıtkeypress

movf keypress,w ; is keypress = 12 - cancel?
xorlw '-'
btfsc status,z
return ; yes

movf keypress,w
xorlw 'd' ; is key = 15? - completion code number
btfsc status,z
goto ext5 ; yes

btfsc keypress,6 ; is val >= 'a'?
goto ext3

movf keypress,w
addlw 201 ; is val greater than 7?
btfsc status,c
goto ext3 ; yes, so try again

movf keypress,w
andlw b'00001111'
btfsc status,z ; is val = 0?
goto ext3 ; yes, so try again
call bıtvalue
movwf store3
goto ext2a

ext5 movf store3,w ; store entry/exit zone
movwf exıtzone
movwf store1
movlw .5
call setprm

movf exıtzone,w
iorwf ınclzone,f ; set ınclzone to include entry/exit zone
movf ınclzone,w ; store new val for ınclzone
movwf store1
movlw .4
call setprm
call storıt
return

;********** set zones to be monıtored

setmonıtor call lcd1 ;set lcd for line 1, cell 1
bsf rslıne,4 ;set lcd rs line high

clrf loop ;clear loop
mon2 movf loop,w ;get table address
call watchmsg ;get message letter
call lcdout ;show it
incf loop,f ;inc loop
btfss loop,4 ;has last lcd letter been sent?
goto mon2 ;no

movf ınclzone,w
movwf store3 ; temp store ıntruded status
call clrlıne2

watch2 call lcd21 ;set address for line 2 cell 1
bsf rslıne,4 ;set rs for data send
movf store3,w
movwf store1 ; store ıntruded status
call showzone

mon2a call waıtkeyrelease
mon3 call waıtkeypress

movf keypress,w ; is keypress = 12 - cancel?
xorlw '-'
btfsc status,z
return ; yes

movf keypress,w
xorlw 'd' ; is key = 15? - completion code number
btfsc status,z
goto mon7 ; yes

btfsc keypress,6 ; is val >= 'a'?
goto mon3

movf keypress,w
addlw .200 ; is val greater than 8?
btfsc status,c
goto mon3 ; yes, so try again

movf keypress,w
andlw b'00001111'
btfsc status,z
goto mon2a

call bıtvalue
movwf store1
movwf store2

movf store3,w ; toggle existing bit into store
addwf store1,w
andwf store1,f

comf store2,w ; invert value
andwf store3,w ; and to clear existing bit

iorwf store1,w
iorwf exıtzone,w ; ensure that entry/exit zone is always set
movwf store3
bsf store3,7
goto watch2

mon7 movf store3,w
movwf ınclzone
movwf store1
movlw .4
call setprm
call storıt
return

;..............

storıt movlw ' '
call lcdout
movlw 's'
call lcdout
movlw 't'
call lcdout
movlw 'o'
call lcdout
movlw 'r'
call lcdout
movlw 'e'
call lcdout
movlw 'd'
call lcdout
movlw ' '
call lcdout
movlw ' '
call lcdout

call pausıt
call pausıt

call lcd1 ;set lcd for line 1, cell 1
bsf rslıne,4 ;set lcd rs line high
clrf loop ;
stor2 movf loop,w ;
movlw ' ' ;clear cell
call lcdout ;show it
incf loop,f ;inc loop
btfss loop,4 ;has last lcd letter been sent?
goto stor2 ;no
call clrlıne2
return

;...........

waıtkeyrelease
wkr2 call keypad1 ; wait till key released
movf keypress,w
btfss status,z
goto wkr2
return

waıtkeypress
wkp2 call keypad1 ; wait till key pressed
movf keypress,w
btfsc status,z
goto wkp2
return

showzone movlw '1'
movwf loop
movlw b'00000001'
movwf count0
show2 movf count0,w
andwf store1,w
movlw '-'
btfss status,z
movf loop,w
call lcdout
incf loop,f
bcf status,c
rlf count0,f
btfss status,c
goto show2
return

showzone2 movlw b'00000001'
movwf count0
show3 movf count0,w
andwf store1,w
movlw 'o'
btfss status,z
movlw 'c'
call lcdout
bcf status,c
rlf count0,f
btfss status,c
goto show3
return

;********* change bell on tıme

setbelltıme call lcd1 ;set lcd for line 1, cell 1
bsf rslıne,4 ;set lcd rs line high

clrf loop ;clear loop
bel2 movf loop,w ;get table address
call belltımemsg ;get message letter
call lcdout ;show it
incf loop,f ;inc loop
btfss loop,4 ;has last lcd letter been sent?
goto bel2 ;no

call clrlıne2
call lcd21 ;set lcd for line 2, cell 1
bsf rslıne,4 ;set lcd rs line high
movlw '?'
call lcdout
movlw '?'
call lcdout
movlw ' '
call lcdout
movlw 'p'
call lcdout
movlw 'r'
call lcdout
movlw 'e'
call lcdout
movlw 'v'
call lcdout
movlw ' '
call lcdout

movf belltıme,w
call lcdfrm

movlw ' '
call lcdout
movlw 'm'
call lcdout
movlw 'a'
call lcdout
movlw 'x'
call lcdout
movlw '2'
call lcdout
movlw '0'
call lcdout

call lcd21 ;set lcd for line 2, cell 1
bsf rslıne,4 ;set lcd rs line high

call waıtkeyrelease
bel3 call waıtkeypress ; get first value (tens)
movf keypress,w ; is keypress = 12 - cancel?
xorlw '-'
btfsc status,z
return ; yes

btfsc keypress,6 ; is val >= 'a'?
goto bel3

movf keypress,w
addlw .205 ; is val greater than 2?
btfsc status,c
goto bel3 ; yes, so try again
movf keypress,w
andlw b'00001111'

movwf count1
iorlw .48
call lcdout

call waıtkeyrelease
bel4 call waıtkeypress ; get 2nd val (units)
movf keypress,w ; is keypress = 12 - cancel?
xorlw '-'
btfsc status,z
return ; yes

btfsc keypress,6 ; is val >= 'a'?
goto bel4

movf keypress,w
addlw .198 ; is val greater than 9?
btfsc status,c
goto bel4 ; yes, so try again
movf keypress,w
andlw b'00001111'
movwf count0

btfss count1,1 ; is count1 (tens) = 2?
goto bel4a ; no
clrf count0 ; yes, so clear units

bel4a movf count0,w ; is total value = 0?
iorwf count1,w
btfsc status,z
goto bel4 ; yes

movf count0,w ; no
iorlw .48
call lcdout

bel5 call waıtkeyrelease
call waıtkeypress
movf keypress,w
xorlw 'd' ; is key = 15? - completion code number
btfsc status,z
goto bel6 ; yes

movf keypress,w
xorlw '-' ; is key = 12? - error in number so start again
btfss status,z
goto bel5 ; no
goto setbelltıme ; yes

bel6 swapf count1,w
iorwf count0,w
movwf belltıme
movwf store1
movlw .9
call setprm
call storıt
call waıtkeyrelease
return

;............

clrlıne1 call lcd1 ;set address for line 1 cell 1
bsf rslıne,4 ;set rs for data send
clrf loop ;
clrl1 movf loop,w ;
movlw ' ' ;clear cell
call lcdout ;
incf loop,f ;inc loop
btfss loop,4 ;has last lcd letter been sent?
goto clrl1 ;no
return

clrlıne2 call lcd21 ;set address for line 2 cell 1
bsf rslıne,4 ;set rs for data send
clrf loop ;
clrl2 movf loop,w ;
movlw ' ' ;clear cell
call lcdout ;
incf loop,f ;inc loop
btfss loop,4 ;has last lcd letter been sent?
goto clrl2 ;no
return

;..............

contınueentry bcf ıntcon,2 ; yes, clear timer flag
entry2 btfss ıntcon,2 ; has timer rollover occurred?
goto entry2 ; no
bcf ıntcon,2 ; yes, clear timer flag
decfsz clkcnt,f ; no, decrement clock routine. ıs it = 0?
return
movlw .25 ; reset start value of clkcnt
movwf clkcnt ; 23 used because of debounce call in keypad1 routine
decf entrydelay,f ; dec secs count
return

;.............

; **** assess zone logıc

assesslogıc call lcd1 ;set lcd for line 1, cell 1
bsf rslıne,4 ;set lcd rs line high

clrf loop ;clear loop
asl1 movf loop,w ;get table address
call zonelogıc ;get message letter
call lcdout ;show it
incf loop,f ;inc loop
btfss loop,4 ;has last lcd letter been sent?
goto asl1 ;no
call clrlıne2

asl2 ; movf portd,w
call monıtor
movf zonesval,w
movwf store3

call lcd21 ;set lcd for line 2, cell 1
bsf rslıne,4 ;set lcd rs line high
movf store3,w
movwf store1
call showzone2

call keypad1
movf keypress,w ; is keypress = 12 - cancel?
xorlw '-'
btfsc status,z
return ; yes

movf keypress,w
xorlw 'd' ; is key = 15? - completion code number
btfss status,z
goto asl2 ; no

movf store3,w ; store normal zone status
movwf zonenormal
movwf store1
movlw 10
call setprm
call storıt
return

; **** show preset zone logıc

presetlogıc call lcd1 ;set lcd for line 1, cell 1
bsf rslıne,4 ;set lcd rs line high

clrf loop ;clear loop
shl1 movf loop,w ;get table address
call showlogıc ;get message letter
call lcdout ;show it
incf loop,f ;inc loop
btfss loop,4 ;has last lcd letter been sent?
goto shl1 ;no
call clrlıne2

call lcd21 ;set lcd for line 2, cell 1
bsf rslıne,4 ;set lcd rs line high
movf zonenormal,w
movwf store1
call showzone2
call waıtkeyrelease

shl2 call keypad1
movf keypress,w ; is keypress = 12 - cancel?
xorlw '-'
btfss status,z
goto shl2
return ; yes

;******** beyond thıs poınt ıts all for keypad 2 assocıated routınes

;********* set 2nd pın code - via keypad 1

pıncode2 call lcd1 ;set lcd for line 1, cell 1
bsf rslıne,4 ;set lcd rs line high

clrf loop ;clear loop
pınc2 movf loop,w ;get table address
call pın2msg ;get message letter
call lcdout ;show it
incf loop,f ;inc loop
btfss loop,4 ;has last lcd letter been sent?
goto pınc2 ;no

call clrlıne2
call lcd21 ;set lcd for line 2, cell 1
bsf rslıne,4 ;set lcd rs line high

movlw pın4
movwf fsr
clrf loop

pınc3 call waıtkeyrelease
call waıtkeypress

movf keypress,w
xorlw '-' ; is key = 12? - error in number so start again
btfss status,z ;
goto pınc3a ;
movf loop,w ; is loop = 0?
btfss status,z
goto pıncode2 ; no, so clear and continue
return ; yes, so exit

pınc3a movf keypress,w ; is val greater than 11?
xorlw 'd' ; is it = 14?
btfsc status,z
goto pınc3 ; yes, so try again
movf keypress,w ; is val greater than 11?
xorlw 'e' ; is it = 15?
btfsc status,z
goto pınc3 ; yes, so try again

movf keypress,w
movwf ındf ; no, store it into pınx and eeprom
movwf store1 ; and send to lcd
movf loop,w
addlw .11
call setprm
movf keypress,w
call lcdout
incf fsr,f
incf loop,f
btfss loop,2
goto pınc3

pınc4 call waıtkeyrelease
call waıtkeypress
movf keypress,w
xorlw 'd' ; is key = 16? - completion code number
btfsc status,z
goto pınc5 ; yes

movf keypress,w
xorlw '-' ; is key = 12? - error in number so start again
btfss status,z
goto pınc4 ; no
goto pıncode2

pınc5 call storıt
call waıtkeyrelease
return

;******* check pın code2 entry

pınentry2 call keypad2 ; is key pressed?
movf keypress2,w
btfsc status,z
return ; no, so return

movf keypress2,w ; is keypress = pin number?
xorwf pın4,w
btfss status,z
goto close2

call waıtkeyrelease2
call waıtkeypress2
movf keypress2,w ; is keypress = pin number?
xorwf pın5,w
btfss status,z
goto close2

call waıtkeyrelease2
call waıtkeypress2
movf keypress2,w ; is keypress = pin number?
xorwf pın6,w
btfss status,z
goto close2

call waıtkeyrelease2
call waıtkeypress2
movf keypress2,w ; is keypress = pin number?
xorwf pın7,w
btfss status,z
goto close2
bsf portb,5 ; yes, so activate portb output rb5
call waıtkeyrelease2
movf entrytıme2,w
movwf entrydelay2
movlw .25 ; reset start value of clkcnt2
movwf clkcnt2
return

close2 bcf portb,5 ; no, so clear portb output rb5
return

;..........get keypad 2 val routıne........

keypad2 clrf keypress2
movlw b'00001111'
movwf portc
movwf store
nop ;pause to allow portc to stabilise
; comf portb,w ;get & invert portb
comf portd,w ;get & invert portd
movwf stored
swapf stored,w ; take bits 4-7
andlw b'00001111' ;isolate bits 0-3
btfsc status,z ;is result not zero (keys pressed)?
return ;no, so return to main prog

movlw b'10000000' ;yes, a key is pressed so get it
movwf swıtch1 ;initial val for rc4-7
movlw .3 ;initial val for col
movwf col
clrf row ;initial val for row

getıt2 comf swıtch1,w ;get and invert val for portc
iorwf store,w
movwf portc ;output to portc
nop ;pause to allow portc to stabilise
; comf portb,w ;get and invert val from portb
comf portd,w ;get and invert val from portd
movwf stored
swapf stored,w ; take bits 4-7
andlw .15 ;isolate bits 0-3
btfss status,z ;is it zero?
goto get22 ;no, so goto analysis routine
decf col,f ;dec col val
bcf status,c ;clear carry flag
rrf swıtch1,f ;divide rc7-4 val by 2
movf swıtch1,w ;
andlw b'11110000'
btfss status,c ;is it zero?
goto getıt2 ;no, so continue loop
return ;yes, so return to main program

get22 movwf swval ;store portb val
clrf row ;clear row count
clrf rownum ;clear row number count

get23 rrf swval,f ;rotate right portb store val
btfsc status,c ;is carry flag set?
goto sumıt2 ;yes so key pressed, go & finish answer
movlw .4
addwf row,f ;add matrix val to row count
incf rownum,f ;inc row number count
btfss rownum,2
goto get23

sumıt2 movf row,w ;sum up results to single answer
addwf col,w ;add row to col (total of 0-15)
call value
movwf keypress2 ; store result into keypress
; movwf keypress ; store result into keypress
call debounce
return ;return to main program

waıtkeyrelease2
wkr22 call keypad2 ; wait till key released
movf keypress2,w
btfss status,z
goto wkr22
return

waıtkeypress2
wkp22 call keypad2 ; wait till key pressed
movf keypress2,w
btfsc status,z
goto wkp22
return

;********* change entry/exıt tıme for keypad 2

changeentry2 call lcd1 ;set lcd for line 1, cell 1
bsf rslıne,4 ;set lcd rs line high

clrf loop ;clear loop
ent22 movf loop,w ;get table address
call entrytıme ;get message letter
call lcdout ;show it
incf loop,f ;inc loop
btfss loop,4 ;has last lcd letter been sent?
goto ent22 ;no

call lcd5 ;set lcd for line 1, cell 5
bsf rslıne,4 ;set lcd rs line high
movlw 'e'
call lcdout
movlw 'n'
call lcdout
movlw 't'
call lcdout
movlw 'r'
call lcdout
movlw 'y'
call lcdout
movlw '2'
call lcdout

call clrlıne2
call lcd23 ;set lcd for line 2, cell 3
bsf rslıne,4 ;set lcd rs line high
movlw ' '
call lcdout
movlw 'p'
call lcdout
movlw 'r'
call lcdout
movlw 'e'
call lcdout
movlw 'v'
call lcdout
movlw ' '
call lcdout
movf entrytıme2,w
movwf count0
call bın2dec

movf dıgıt2,w
addlw .48
call lcdout
movf dıgıt1,w
addlw .48



Reklamlar

2 Kullanıcı bu konu için electronickim arkadaşımıza teşekkür ettiler




asm içindeki kelimeleri Türkçeleştirme


Benzer Konular
- asm içindeki kelimeleri Türkçeleştirme
- elektromanyetik dalgaların biyolojik dokular içindeki yayılımınının f.d.t.d ile
- Pic içindeki hex i kopyalamak

- reaktif güç kontrol rölesinin içindeki devreler hangi tip devrelerdir - yardım

- office 2007 türkceleştirme?
- iletkenlerin pvc boru içindeki durumu
- ingilizce kelimeleri zevkle öğrenin (kelime ezber v2.4)
- 100 metre BLUETOOTH içindeki devreye bir bakın
- Civilization Warlords içindeki tanıdık yüz

- Program Türkçeleştirme-Uygulamalı


Sitemize üyelik ve içeriğin indirilmesi tamamen ücretsizdir. Sitemizde paylaşılan tüm dokümanlar (Tezler, makaleler, ders notları, sınav soru cevaplar, projeler) paylaşımcıların bireysel çalışmaları olup telif hakları kendilerine aittir ya da açık bir şekilde kamusal alana yerleştirilmiş dokümanların birer kopyalarıdır. Kişilerin bireysel çalışmalarını sitemizde yüklemesinde, sitemizde paylaşıma teşvik eden puanlama sisteminin de etkisi büyüktür. Bunlara rağmen hala size ait olan ve burada bulunmasına izin vermediğiniz dokümanlar varsa iletişim bölümünden yöneticilere bildirmeniz durumunda derhal silineceklerdir.
Powered by phpBB | Translated by phpBB Turkiye | Ads by Google Adsense | Design by Crazy Bat based