asm hakkında yardım

Başlatan electronickim, 13 Mart 2012, 20:11:33

electronickim

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.


;ALARM415.ASM 12DEC02 - COPYRIGHT JOHN BECKER - EPE INTRUDER ALARM

;PIC16F877-4, 3.2768MHz, WDT OFF, POR ON, XTAL XS

;Config register bits
; CP1 CP0 DBG NIL 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 PIC '87 data sheet.

#DEFINE PAGE0   BCF 0x03,5
#DEFINE PAGE1   BSF 0x03,5

   List P = PIC16F877, R=DEC;
       __CONFIG   h'3F31'

INDF    EQU 0x00  ;page 0, 1, 2, 3
OPTION_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
TRISA   EQU 0x05  ;page 1
PORTB   EQU 0x06  ;page 0, 2
TRISB   EQU 0x06  ;page 1, 3
PORTC   EQU 0x07  ;page 0
TRISC   EQU 0x07  ;page 1
PORTD   EQU 0x08  ;page 0
TRISD   EQU 0x08  ;page 1
PORTE   EQU 0x09  ;page 0
TRISE   EQU 0x09  ;page 1

PCLATH  EQU 0x0A  ;page 0, 1, 2, 3
INTCON  EQU 0x0B  ;page 0, 1, 2, 3

EEDATA  EQU 0x0C  ;page 2
EECON1  EQU 0x0C  ;page 3
         
PIR2    EQU 0x0D  ;page 0
EEADR   EQU 0x0D  ;page 2
EECON2  EQU 0x0D  ;page 3

ADCON1  EQU 0x1F  ;page 1

SLOWIT   EQU 0x20        ; pause counter
CLKCNT   EQU 0x21
CLKSEC   EQU 0x22
CLKMIN   EQU 0x23
CLKHRS   EQU 0x24
LOOP     EQU 0x25
LOOPA    EQU 0x26
RSLINE   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

SWITCH1   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
PIN0      EQU 0x35   ; 1st pin number val FIRST KEYPAD
PIN1      EQU 0x36   ; 2nd pin number val
PIN2      EQU 0x37   ; 3rd pin number val
PIN3      EQU 0x38   ; 4th pin number val

EXITTIME  EQU 0x39   ; entry/exit delay
EXITZONE  EQU 0x3A   ; entry/exit zone
INCLZONE  EQU 0x3B   ; zones to be included in monitoring

BELLTIME      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
ENGINEERSET  EQU 0x3F ; flag to indicate if ENGINEER has been called
PREVALARMZONE EQU 0x40 ; previous alarm condition register
ENTRYDELAY   EQU 0x41 ; counter for entry/exit delay
PIN4         EQU 0x42   ; 1st pin number val FOR 2ND KEYPAD
PIN5         EQU 0x43   ; 2nd pin number val
PIN6         EQU 0x44   ; 3rd pin number val
PIN7         EQU 0x45   ; 4th pin number val
KEYPRESS2    EQU 0x46   ; value of key pressed keypad2
ENTRYTIME2   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
DIGIT1  EQU    0x53            ;lsd
DIGIT2  EQU    0x54
BITCNT  EQU    0x5B
DIGCNT  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
GIE    EQU 7           ;INTCON 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
EEIF   EQU 4           ;PIR2 reg

BUZZER EQU 0
STROBE EQU 1
BELL   EQU 2
PANIC  EQU 4
RBIF   EQU 0

;............. DATA EEPROM USE

                ; 0-3  PIN CODE
                ; 4    ZONES EXCLUDED
                ; 5    ENTRY/EXIT ZONE
                ; 6    ENTRY/EXIT DELAY
                ; 7    ZONES INTRUDED (AlarmZone)
                ; 8    ALARM ON/OFF & BELL, BUZZER, STROBE STATUS (AlarmStatus)
                ; 9    BELL ON TIME (MAX 15 MINS)
                ; 10   NORMAL ZONE STATUS
                ; 11-14 2ND PIN CODE
                ; 15   ENTRY DELAY VIA KEYPAD2

        ORG 0x0004      ;Interrupt vector address
        GOTO GIEOFF     ;Jump to interrupt routine on interrupt
        ORG 0x0005      ;Start of program memory

GIEOFF BCF INTCON,GIE  ;turn off global interrupts
        BTFSC INTCON,GIE
        goto GIEOFF
        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'

BITVALUE 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

PINCODE ADDWF PCL,F       ; change pin code message
        retlw 'C'
        retlw 'H'
        retlw 'A'
        retlw 'N'
        retlw 'G'
        retlw 'E'
        retlw ' '
        retlw 'P'
        retlw 'I'
        retlw 'N'
        retlw ' '
        retlw 'C'
        retlw 'O'
        retlw 'D'
        retlw 'E'
        retlw ' '

PIN2MSG 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 'I'
        retlw 'N'
        retlw ' '
        retlw 'C'
        retlw 'O'
        retlw 'D'
        retlw 'E'

ENTRYTIME ADDWF PCL,F       ; change ENTRY/EXIT time message
        retlw 'S'
        retlw 'E'
        retlw 'T'
        retlw ' '
        retlw 'I'
        retlw 'N'
        retlw '/'
        retlw 'O'
        retlw 'U'
        retlw 'T'
        retlw ' '
        retlw 'T'
        retlw 'I'
        retlw 'M'
        retlw 'E'
        retlw ' '

BELLTIMEMSG ADDWF PCL,F       ; change ENTRY/EXIT 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 'I'
        retlw 'M'
        retlw 'E'

ENTRYZONE ADDWF PCL,F       ; set ENTRY/EXIT zone message
        retlw 'S'
        retlw 'E'
        retlw 'T'
        retlw ' '
        retlw 'I'
        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'

ZONELOGIC 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'

SHOWLOGIC 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 'I'
        retlw 'C'
        retlw ' '

PASSIVEMSG ADDWF PCL,F       ; passive alarm message
        retlw 'M'
        retlw 'O'
        retlw 'N'
        retlw 'I'
        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 TRISB
        movlw b'00001111'     ;RC0-RC3 as input, RC4-RC7 as output
        movwf TRISC         
        movlw .255
        movwf TRISD         ;PORTD as input
        clrf TRISE          ;PORTE as output
        movlw b'00000111'     ;PORT A/E as digital
        movwf ADCON1        ;
        movlw b'11000000'     ;RA0-RA5 as outputs
        movwf TRISA

        movlw b'00000110'     ;timer 1128 (1/25th sec)
        movwf OPTION_REG
        PAGE0
        clrf INTCON
        call PAUSIT     ;1/5 sec delay

LCDSET clrf LOOP       ;clr LCD set-up loop
        clrf RSLINE     ;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 PAUSIT     ;1/5 sec delay

        clrf ENGINEERSET
        bsf ALARMSTATUS,6   ; set Power interruption flag

        call KEYPAD1    ; is ENGINEER 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 ENGINEERSET,0
        bcf ALARMSTATUS,6   ; clear Power interruption flag

        movlw b'10000001' ; default set INCLZONE 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 EXITTIME to 30 secs in binary
        movwf STORE1
        movlw .6
        call SETPRM

        clrf STORE1     ; default clear INTRUDED 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 ENTRYTIME to 30 secs in binary for keypad2
        movwf STORE1
        movlw .15
        call SETPRM

        call ENGINEER   ; yes, set ENGINEER entry code and reset all defaults

SETCLK clrf CLKSEC     ;clear seconds counter
        clrf CLKMIN     ;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 PIN CODE
        call PRMGET
        movwf PIN0
        movlw .1
        call PRMGET
        movwf PIN1
        movlw .2
        call PRMGET
        movwf PIN2
        movlw .3
        call PRMGET
        movwf PIN3

        movlw .4            ; RECALL INCLUDED/EXCLUDED ZONES
        call PRMGET
        movwf INCLZONE
        bsf INCLZONE,7     ; ensure bit 7 (1st PANIC zone) is always on

        movlw .5            ; RECALL ENTRY/EXIT ZONE
        call PRMGET
        movwf EXITZONE
        movlw .6            ; RECALL ENTRY/EXIT TIME
        call PRMGET
        movwf EXITTIME
        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 TIME
        call PRMGET
        movwf BELLTIME
        movlw .10           ; RECALL "NORMAL ZONE STATUS
        call PRMGET
        movwf ZONENORMAL

        movlw .11           ; RECALL PIN CODE 2
        call PRMGET
        movwf PIN4
        movlw .12
        call PRMGET
        movwf PIN5
        movlw .13
        call PRMGET
        movwf PIN6
        movlw .14
        call PRMGET
        movwf PIN7

        movlw .15           ; RECALL ENTRY TIME FOR KEYPAD2
        call PRMGET
        movwf ENTRYTIME2

        btfss ALARMSTATUS,7 ; is alarm on?
        goto ITSOFF
        call CHECKZONE2
        bsf ALARMSTATUS,6   ; set Power interruption flag
        goto MAIN

ITSOFF call ALARMOFF   ; show ALARM OFF message
        btfsc ENGINEERSET,0 ; has ENGINEER been called?
        goto MAIN       ;yes

        call LCD21      ;set address for line 1 cell 1
        bsf RSLINE,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 ENGINEERSET   ; clear ENGINEER flag

;............................ END OF SETUP

MAIN   call CHECKMODE
        call PINENTRY2
        movf ENTRYDELAY2,W  ; has entry2 delay timed out?
        btfss STATUS,Z
        call CONTINUEENTRY2 ; no, continue countdown of entry2
        goto MAIN

ALARMISON btfss ALARMSTATUS,7 ; is alarm on ?
        return            ; no
        call MONITOR      ; get current status of zones 1-8
        call CHECKZONE    ; compare current and preset zones status
        call SETBELLS
        call CLKIN
        return

PASSIVEALARM
        call MONITOR      ; 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 RSLINE,4       ;set RS for data send
        movf ZONESVAL,W
        movwf STORE1       ; store INTRUDED status
        call SHOWZONE
        return

;******* CHECK MODE

CHECKMODE call KEYPAD1   ; is key pressed?
        movf KEYPRESS,W
        btfsc STATUS,Z
        return            ; no, so return

CHECKM2 call WAITKEYPRESS
        movf KEYPRESS,W      ; is keypress = pin number?
        xorwf PIN0,W
        btfss STATUS,Z
        return

        call WAITKEYRELEASE
        call WAITKEYPRESS
        movf KEYPRESS,W      ; is keypress = pin number?
        xorwf PIN1,W
        btfss STATUS,Z
        return

        call WAITKEYRELEASE
        call WAITKEYPRESS
        movf KEYPRESS,W      ; is keypress = pin number?
        xorwf PIN2,W
        btfss STATUS,Z
        return

        call WAITKEYRELEASE
        call WAITKEYPRESS
        movf KEYPRESS,W      ; is keypress = pin number?
        xorwf PIN3,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 RSLINE,4    ;set RS for data send
        clrf LOOP       ;clear loop
        bsf RSLINE,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 CLRLINE2

AMEND2 clrf ALARMSTATUS
        clrf ALARMZONE
        clrf PREVALARMZONE

        call WAITKEYRELEASE
        call WAITKEYPRESS

        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 PIN code?
        xorlw '1'
        btfss STATUS,Z
        goto CHECK1
        call ENGINEER
        goto AMEND0

CHECK1 movf KEYPRESS,W  ; is keypress = '2' - change ENTRY/EXIT time?
        xorlw '2'
        btfss STATUS,Z
        goto CHECK2
        call CHANGEENTRY
        goto AMEND0

CHECK2 movf KEYPRESS,W  ; is keypress = '3' - change ENTRY/EXIT 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 SETMONITOR
        goto AMEND0

CHECK4 movf KEYPRESS,W  ; is keypress = '5' - select bell on time (max 15 mins)
        xorlw '5'
        btfss STATUS,Z
        goto CHECK5
        call SETBELLTIME
        goto AMEND0

CHECK5 movf KEYPRESS,W  ; is keypress = '6' - assess normal zone logic
        xorlw '6'
        btfss STATUS,Z
        goto CHECK6
        call ASSESSLOGIC
        goto AMEND0

CHECK6 movf KEYPRESS,W  ; is keypress = '7' - preset normal zone logic
        xorlw '7'
        btfss STATUS,Z
        goto CHECK7
        call PRESETLOGIC
        goto AMEND0

CHECK7 movf KEYPRESS,W  ; is keypress = '8' - set 2nd pin code
        xorlw '8'
        btfss STATUS,Z
        goto CHECK8
        call PINCODE2
        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 SETPASSIVE

CHECK15
        goto AMEND2


; ******** PASSIVE MODE

SETPASSIVE call LCD1  ;set LCD for line 1, cell 1
         bsf RSLINE,4   ;set LCD RS line high

        clrf LOOP       ;clear loop
SETP2  movf LOOP,W     ;get table address
        call PASSIVEMSG ;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/EXIT TIME

CHANGEENTRY call LCD1  ;set LCD for line 1, cell 1
         bsf RSLINE,4   ;set LCD RS line high

        clrf LOOP       ;clear loop
ENT2   movf LOOP,W     ;get table address
        call ENTRYTIME  ;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 CLRLINE2
        call LCD23      ;set LCD for line 2, cell 3
        bsf RSLINE,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 EXITTIME,W
        movwf COUNT0
        call BIN2DEC

        movf DIGIT2,W
        addlw .48
        call LCDOUT
        movf DIGIT1,W
        addlw .48
        call LCDOUT

        call LCD21      ;set LCD for line 2, cell 1
        bsf RSLINE,4    ;set LCD RS line high

        call WAITKEYRELEASE
ENT3   call WAITKEYPRESS ; 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 WAITKEYRELEASE
ENT4   call WAITKEYPRESS   ; 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 WAITKEYRELEASE
        call WAITKEYPRESS
        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 WAITKEYRELEASE
        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 EXITTIME
        movf EXITTIME,W
        movwf STORE1
        movlw .6
        call SETPRM
        call STORIT
        return

;********* MONITOR ZONES   *********

MONITOR 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 CONTINUEENTRY2 ; 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 INCLZONE,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 EXITZONE,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 CONTINUEENTRY ;

        call LCD21          ;set address for line 1 cell 1
        bsf RSLINE,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 INTRUDED status
        movlw .7
        call SETPRM

CHECKZONE2                ; called also from power up entry
        call LCD1          ;set address for line 1 cell 1
        bsf RSLINE,4       ;set RS for data send
        movf ALARMZONE,W
        movwf STORE1       ; store INTRUDED status
        call SHOWZONE

        clrf LOOP       ;clear loop
        bsf RSLINE,4    ;set RS for data send
        btfss ALARMSTATUS,PANIC
        goto LCDMS3     ; ...... TRIG
        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

TRIG   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 UPDATING

CLKIN  btfss ALARMSTATUS,STROBE  ; clock only used if strobe active
        return                    ; allowing elapsed time since first zone triggered to be shown
        btfss INTCON,2            ; has timer rollover occurred?
        return                    ; no

        BCF INTCON,2     ; yes, clear timer flag
        decfsz CLKCNT,F  ; increment clock routine. Is 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 INDF,F     ;inc units
        movlw .6
        addwf INDF,W    ;if 6 is added is there a digit carry?
        btfss STATUS,DC
        goto CHK15      ;no
        movwf INDF      ;yes
        movlw .160
        addwf INDF,W    ;if 160 is added is there a carry
        btfss STATUS,C  ;(adding 160 checks if tens of units = 6)
        goto CHK15      ;no
        clrf INDF       ;yes
        incf FSR,F
        decfsz LOOPA,F
        goto ADDCLK

CHK15  movf CLKMIN,W         ; has bell been on for set number of mins?
        xorwf BELLTIME,W      ; mins in BCD (max 20)
        btfsc STATUS,Z
        bcf ALARMSTATUS,BELL

CLKSHW call LCD21      ;set address for line 1 cell 9
        bsf RSLINE,4    ;set RS for data send
        movf CLKHRS,W   ;get hrs
        call LCDFRM     ;format and send it
        movlw ' '       ;insert colon
        call LCDOUT
        movf CLKMIN,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 ROUTINE........

KEYPAD1 clrf KEYPRESS
         btfss INTCON,RBIF    ; has Panic been pushed
         goto KP2             ; no
         call PANICSET

KP2     btfsc ALARMSTATUS,7  ; is alarm on?
         call ALARMISON       ; yes
         btfsc ALARMSTATUS,5  ; is alarm on?
         call  PASSIVEALARM   ; 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 SWITCH1    ;initial val for RC4-7
         movlw .3          ;initial val for COL
         movwf COL
         clrf ROW         ;initial val for ROW

GETIT   comf SWITCH1,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 SWITCH1,F    ;divide RC7-4 val by 2
         movf SWITCH1,W   ;
         andlw b'11110000'
         btfss STATUS,C   ;is it zero?
         goto GETIT       ;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 SUMIT       ;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

SUMIT   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 ENGINEER'S PIN CODE

ENGINEER call LCD1       ;set LCD for line 1, cell 1
         bsf RSLINE,4     ;set LCD RS line high

        clrf LOOP       ;clear loop
ENG2   movf LOOP,W     ;get table address
        call PINCODE    ;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 CLRLINE2
        call LCD21      ;set LCD for line 2, cell 1
        bsf RSLINE,4    ;set LCD RS line high

        movlw PIN0
        movwf FSR
        clrf LOOP

ENG3   call WAITKEYRELEASE
        call WAITKEYPRESS

        movf KEYPRESS,W
        xorlw '-'        ; is key = 12? - error in number so start again
        btfss STATUS,Z   ; ... c
        goto ENG4        ; ... ENG

Kabil ATICI

buradaki sorun lcd ekranlarda türkçe karakterlerin bulunmaması ve varsa bile  lcd üzerindeki adreslerinin ascii yerlerinden farklı olmasından kaynaklanıyor. Bunun içir LCD ilk açılışta ayrılmış 8 tane ram bölgesine (bunlara karakterlerin adreslerinin 0-8 adresine denk düşüyor) ekranda gösterilecek karakterin verilerinin yüklenmesi gerekiyor. Bunlarla ilgili ayrıntılı bilgiyi LCD üreticilerinde bulanabilirsin.

Bu işleme asm olarak atmel serisi işlemcilerde yaptım, ama pic üzerinde henüz bir çalışmam olmadı.

Yanlış hatırlamıyorsam karakter 8 baytlık grup halinde yukarından aşağı karakteri tanımlayacak şekilde (5 bitlik bölümü kullanılarak) oluşturuluyor.
örnek
00001110
00010001
00010001
00011111
00010001
00010001
00010001
00000000
bu verler sırayla CGRAM bölümüne yükleniyor. Bu karakter çağrılırken ram adresi olarak 0x00,0x01... şeklinde hangi adrese denk düşüyorsa o şekilde çağrılıyor... örneğin "0" karakteri 0x30 adresindedir.
ambar7

Mujdat117

hocam sorun yok bence sadece şu var örneğin
"all off " 8 karekter olarak tanımlanmış
alloff addwf pcl,f
        retlw 'a'
        retlw 'l'
        retlw 'l'
        retlw ' '
        retlw 'o'
        retlw 'f'
        retlw 'f'
        retlw ' '
yazılım bu satırı 8 defada tek tek çağırıyo sizin yazdığınız "alarm kapalı " yazısı ise 12 karekterli sizin yazdığınızın sadece 8 karekterini çektiği için ekranda sadece "alarm ka" yazısı görünüyor düzeltmek basit sadece ekrana yazı gönderen kodun başında yüklenecek karekter sayısın yazdığınız yazıya göre belirtmeniz gerekli sorun çözülecektir.
Ayinesi iştir kişinin lâfa bakılmaz.Şahsın görünür rütbe-i aklı eserinde

electronickim

müjdat bey bende eminim ekrana yazı gönderen kodun başına karakter sayısını yazdığımda düzeleceğinden. Demek ki aynı şeyler  aklımıza geliyor ama çözüm yok. Ayrıca ekrana yazı gönderen kodun başında 4 rakamı var ve onu eklediğimde diğer yazılarda kayıyor ve farklı yerlerde çıkıyor. Sırf cevap yazmak olsun diye  yazmayın lütfen varsa çözümünüz veya mantıklı bir fikriniz söyleyin lütfen.

bigbey

verdiğiniz kaynak kodda altprogram adları görünmüyor.
altprogram label (etiket) leri ile yeniden edit yaparak programınızı kod ekle seçeneği ile forum sayfasına yükleyebilirseniz nerede değişiklik yapılması gerektiği anlaşılabilir.
sizin oluşturduğunuz tablo hangi başlık altından çağırılıyor anlaşımamaktadır. eğer subroutin başlıklarınıda gösterir şekilde programı yükleyebilirseniz. tablonuz çağrılmadan önce count edilecek sayı yeri bulunabilir.
TA6R

Mujdat117

cevap yazmak için değil yardımcı olmak için yazmıştım ama hata yapmışım.
ayrıca verdiğiniz kod derlenmiyo. Bahsettiğiniz
alloff addwf pcl,f
        retlw 'a'
        retlw 'l'
        retlw 'l'
        retlw ' '
        retlw 'o'
        retlw 'f'
        retlw 'f'
        retlw ' '
rutni nerden ne şekilde çağrıldığı bellli değil madem bilmeden sadece varsayımla konuşuyosuz.
madem farklı bir yöntem soruyosunuz şunu deneyin.
alloff 
movlw 'a';addwf pcl,f
call lcdout
 movlw 'a'       ;retlw 'a'
call lcdout
movlw 'l'        ;retlw 'l'
call lcdout
movlw 'a'        ;retlw 'l'
call lcdout
movlw 'r'        ;retlw ' '
call lcdout
movlw 'm'        ;retlw 'o'
call lcdout
movlw ' '        ;retlw 'f'
call lcdout
movlw 'a'        ;retlw 'f'
call lcdout
movlw 'c'
call lcdout
movlw 'ı'
call lcdout
movlw 'k'
call lcdout
return

Ayinesi iştir kişinin lâfa bakılmaz.Şahsın görünür rütbe-i aklı eserinde