Page 1 of 4 123 ... LastLast
Results 1 to 10 of 40
  1. #1

    Default need your help regarding MPLAB.. URGENT and WILLING TO PAY..


    Hi, i am a student from a certain school here in cebu.. Kanang, magpatabang unta kog trace sa program sa amung thesis nga gihimu sa amung maestra. Ang Software nga gi-gamit is MPLAB.. Urgent kaau.... Thanks.... wiiling ko mo bayad..salamat...

  2. #2
    Quote Originally Posted by outwit View Post
    Hi, i am a student from a certain school here in cebu.. Kanang, magpatabang unta kog trace sa program sa amung thesis nga gihimu sa amung maestra. Ang Software nga gi-gamit is MPLAB.. Urgent kaau.... Thanks.... wiiling ko mo bayad..salamat...
    Good! You're in the right section.. daghan na makatabang nimo, di lang ako..

    as you said, naa gihatag ang teacher ninyu? unsa man to xa? tagai mi sa copy/code nimo aron maka.check pud mi unsa na xa.

    Assembly na or C?

  3. #3
    unsa may purpose na gihatag sa inyo teacher ang code? para tun.an?
    nya ngano man dli nnyu tun.an, busy'g DOTA?

  4. #4
    ibutang lang ngari ang code...
    og unsay wa masabti ky ato tabangan og sabot...

  5. #5
    Quote Originally Posted by stealthghost View Post
    Good! You're in the right section.. daghan na makatabang nimo, di lang ako..

    as you said, naa gihatag ang teacher ninyu? unsa man to xa? tagai mi sa copy/code nimo aron maka.check pud mi unsa na xa.

    Assembly na or C?
    assembly sir... naa ra dy ang code sir....

    taas2 raba ang code sir.. ako lng i.pm nmu sir..??

  6. #6
    Quote Originally Posted by cebugdev View Post
    unsa may purpose na gihatag sa inyo teacher ang code? para tun.an?
    nya ngano man dli nnyu tun.an, busy'g DOTA?
    hahaha. ) dghan man gud kaau mig lisud nga subjects mao wa kaau namu natagad...

  7. #7
    Quote Originally Posted by blaklist25 View Post
    ibutang lang ngari ang code...
    og unsay wa masabti ky ato tabangan og sabot...
    cge sir.. ako i.post.

  8. #8
    ; F_KEYPAD_84A_1.ASM WITH EEPROM
    ; TURN ON ALARM IF ACTIVATED BY PIR AND NO PWD INPUT (TIME-OUT)
    ;================================================= ===================
    ; P R O C E S S O R
    list p=16F84A
    #include <p16F84A.inc>

    __CONFIG _CP_OFF & _WDT_OFF & _PWRTE_ON & _XT_OSC
    ;================================================= ===================
    ; M A C R O S (SEPARATE FILES)
    #include <MOVLF.inc>
    #include <MOVFF.inc>
    #include <SUBLF.inc>
    #include <SUBFF.inc>
    ;================================================= ===================
    ; P R E - L O A D E E P R O M
    ORG 0X2100
    DE 01H, 02H, 03H, 04H ; DEFINE EEPROM CONTENTS AT BURN TIME
    ;================================================= ===================
    ; R E S E T V E C T O R
    ORG 0X000
    GOTO SETTING
    ;================================================= ===================
    ; I N T E R R U P T V E C T O R
    ORG 0X004
    RETFIE
    ;================================================= ===================
    ; M A I N
    SETTING
    BSF STATUS,RP0
    MOVLF 10H,PORTA
    BCF PORTB,7
    BCF OPTION_REG,7
    BCF STATUS,RP0
    CLRF PORTA

    ;--------------------------------------------------------------------
    ; CORRECT INITIAL PASSWORD --> 1 2 3 4 (TO BE PLACED IN EEPROM)
    ; DISABLED, THIS FILE WITH R/W EEPROM
    ;CRK_PWD
    ; MOVLF 01H,17H
    ; MOVLF 02H,18H
    ; MOVLF 03H,19H
    ; MOVLF 04H,1AH
    ;--------------------------------------------------------------------
    ;--------------------------------------------------------------------
    ; TRIGGER PWD INPUT BY RA4 OR # OR ALARM
    TRGR_MAIN
    CALL LEDS_TRGR_MAIN
    BSF STATUS,RP0
    MOVLF 77H,PORTB ; ROW4 OF KEYPAD
    BCF STATUS,RP0
    CALL TST_MRK_BZR
    BCF PORTB,3
    TST_TRGR_BZR
    BTFSS 1DH,0
    GOTO TST_TRGR_RA4 ; ALARM OFF, TEST OTHER TRIGGERS
    GOTO TRGR_PND_PWD ; ALARM ON, PRESS # THEN PWD THEN *
    TST_TRGR_RA4
    BTFSS PORTA,4
    GOTO TST_TRGR_PND ; ALARM OFF, NOT TRIGGERED BY PIR
    ; TRIGGERED BY RA4 (PIR)
    CALL LEDS_IN_PWD ; INPUT PWD (3 ATTEMPTS)
    MOVLF 3CH,29H ; 3CH = 60 LOOPS BEFORE TIME-OUT
    BSF 1FH,7 ; MUST COUNT KEYPAD SCAN
    GOTO INPUT_PWD
    TST_TRGR_PND
    BTFSC PORTB,6
    GOTO TST_TRGR_BZR ; # NOT PRESSED, WAIT FOR TRIGGER
    GOTO TRGR_PND_OPT ; # PRESSED, WAIT FOR OPTION
    ;--------------------------------------------------------------------
    ;--------------------------------------------------------------------
    ; INPUT PWD THEN VERIFY FOR 3 ATTEMPTS
    ; WITH TIME-OUT
    INPUT_PWD
    MOVFF 12H,PORTA ; LOAD CURRENT STATE OF INDICATORS
    INPUT_HERE
    CALL ASK_PWD
    BTFSC 1FH,7
    GOTO INPUT_CONT
    BSF 1DH,0 ; ALLOWED LOOPS FINISHED
    CALL TST_MRK_BZR
    GOTO TRGR_MAIN
    INPUT_CONT
    BTFSS 1DH,2
    GOTO INPUT_HERE ; DID NOT REACH 4 INPUTS YET, WAIT FOR INPUT
    CALL VERIFY_PWD ; VERIFY PWD
    BTFSS 1DH,3 ; CORRECT PWD MARKER
    GOTO INPUT_WRNG ; WRONG PWD, TEST FOR 3RD ATTEMPT
    GOTO TRGR_MAIN ; CORRECT PWD, WAIT FOR INPUT
    ;--------------------------------------------------------------------
    INPUT_WRNG
    BTFSS 1DH,0
    GOTO INPUT_PWD ; ATTEMPTS<3, ASK FOR PWD
    GOTO TRGR_MAIN ; ATTEMPTS=3
    ;--------------------------------------------------------------------
    ;--------------------------------------------------------------------
    ; PRESS # THEN INPUT PWD THEN * (ALARM ALREADY ON)
    TRGR_PND_PWD
    BTFSC PORTB,6
    GOTO TRGR_PND_PWD ; # NOT YET PRESSED
    TRGR_PND_PWD_IN ; # PRESSED, INPUT PWD
    CALL ASK_PWD
    BTFSS 1DH,2
    GOTO TRGR_PND_PWD_IN ; DID NOT REACH 4 INPUTS YET, WAIT FOR INPUT
    CALL VERIFY_PWD ; VERIFY PWD
    BTFSS 1DH,3 ; CORRECT PWD MARKER
    GOTO TRGR_PND_WRNG ; WRONG PWD
    ; CORRECT PWD, PRESS *
    BSF STATUS,RP0
    MOVLF 77H,PORTB ; ROW4 OF KEYPAD
    BCF STATUS,RP0
    BSF PORTB,7 ; ALARM ON
    BCF PORTB,3
    TRGR_PN_PW_AS
    BTFSC PORTB,4 ; *
    GOTO TRGR_PN_PW_AS ; * NOT PRESSED
    BCF PORTB,7 ; * PRESSED, DISABLE ALARM
    BCF 1DH,0
    CLRF PORTA
    GOTO TRGR_MAIN
    ;--------------------------------------------------------------------
    TRGR_PND_WRNG
    MOVLF 0FH,PORTA
    CALL DELAY_FFX
    CLRF PORTA
    GOTO TRGR_MAIN
    ;--------------------------------------------------------------------
    ;--------------------------------------------------------------------
    ; PRESS # THEN EITHER * (PIR SETTINGS), 0 (CHANGE PWD), # (CANCEL)
    TRGR_PND_OPT
    BSF 1DH,4 ; OPTION MODE MARKER
    CALL LEDS_RA3N0
    BTFSC PORTB,6
    GOTO TRGR_PND_TST1 ; # NOT PRESSED
    GOTO TRGR_PND_CNCL ; # PRESSED, CANCEL OPTIONS
    TRGR_PND_TST1
    CALL LEDS_RA3N0
    BTFSC PORTB,4
    GOTO TRGR_PND_TST2 ; * NOT PRESSED
    BSF 1DH,6 ; * PRESSED, SET ACTIVE PIR
    BCF 1DH,7
    ; TURN ON ALL PIRS
    GOTO OPTION_PWD
    TRGR_PND_TST2
    CALL LEDS_RA3N0
    BTFSC PORTB,5
    GOTO TRGR_PND_OPT ; 0 NOT PRESSED, NO KEY PRESSED YET
    BCF 1DH,6 ; 0 PRESSED, CHANGE PWD
    BSF 1DH,7
    GOTO OPTION_PWD
    TRGR_PND_CNCL
    CLRF PORTA
    CALL DELAY_FFX
    BCF 1DH,4
    GOTO TRGR_MAIN
    ;--------------------------------------------------------------------
    ; PRESSED OPTION FOR PIR OR PWD, INPUT CORRECT PWD FIRST
    OPTION_PWD
    CALL LEDS_IN_PWD
    OPTION_KYN
    CALL ASK_PWD
    BTFSS 1DH,5 ; TEST FOR CANCEL
    GOTO OPTION_KY_CNT ; PWD INPUT NOT CANCELLED
    GOTO OPTION_CNCL ; CANCEL CURRENT OPTION
    OPTION_KY_CNT
    BTFSS 1DH,2
    GOTO OPTION_KYN ; DID NOT REACH 4 INPUTS YET, WAIT FOR INPUT
    CALL VERIFY_PWD ; VERIFY PWD
    BTFSS 1DH,3 ; CORRECT PWD MARKER
    GOTO OPTION_CNCL ; WRONG PWD, CANCEL OPTION
    BTFSS 1DH,6 ; CORRECT PWD, CONTINUE TO SELECTED OPTION
    GOTO OPTION_CHNG_PWD ; TEST IF CHANGE PWD
    GOTO ACTIVE_PIR ; SET ACTIVE PIR
    OPTION_CHNG_PWD
    BTFSS 1DH,7
    GOTO OPTION_CNCL ; NO OPTION SELECTED (WILL NOT OCCUR)
    GOTO CHANGE_PWD ; CHANGE PWD
    OPTION_CNCL
    BCF 1DH,5
    BCF 1DH,6
    BCF 1DH,7
    CLRF 12H
    CLRF 11H
    CLRF PORTA
    GOTO TRGR_PND_OPT
    ;--------------------------------------------------------------------
    ; PRESSED *, SET ACTIVE PIR
    ACTIVE_PIR
    BCF 1DH,6
    MOVLF 02H,21H
    PIR_LEDS
    DECFSZ 21H,1
    GOTO PIR_LEDS_DEC
    MOVLF 0FH,PORTA ; TURN ON ALL INDICATORS, PIRS ALL ACTIVE
    MOVLF 0FH,12H ; BACK-UP OF INDICATORS
    GOTO PIR_KEY1_INI
    PIR_KEY1_INI
    MOVFF PORTA,12H ; BACK-UP OF PORTA B4 SELECTION
    PIR_KEY1
    BCF 1FH,2
    CALL KEYPAD ; SCAN KEYPAD
    MOVF 10H,1
    BTFSC STATUS,Z
    GOTO PIR_KEY1 ; NO INPUT YET
    CALL PIR_CHK_KEY
    BTFSS 1FH,1
    GOTO PIR_KEY1_TST ; DIDNT EXIT
    GOTO PIR_EXIT ; EXIT CURRENT OPTION
    PIR_KEY1_TST
    BTFSS 1FH,0
    GOTO PIR_KEY1 ; NOT VALID INPUT
    GOTO PIR_KEY2 ; VALID INPUT
    PIR_KEY2
    BSF 1FH,2
    CALL KEYPAD
    MOVF 10H,1
    BTFSC STATUS,Z
    GOTO PIR_KEY2 ; NO INPUT YET
    CALL PIR_CHK_KEY
    BTFSS 1FH,1
    GOTO PIR_KEY2_TST ; DIDNT EXIT
    GOTO PIR_EXIT ; EXIT CURRENT OPTION
    PIR_KEY2_TST
    BTFSS 1FH,0
    GOTO PIR_KEY2 ; NOT VALID INPUT
    GOTO PIR_KEY2_TST2 ; VALID INPUT
    PIR_KEY2_TST2
    BCF 1FH,0
    BTFSS 1FH,3
    GOTO PIR_TST_DAC ; KEY2=DEACTIVATE
    GOTO PIR_TST_ACT ; KEY2=ACTIVATE
    PIR_TST_DAC
    BTFSS 1FH,4
    GOTO PIR_SET_FIN ; KEY1=DEAC, NO CHANGES IN RA (DEACTIVATE VERIFIED)
    MOVFF 12H,PORTA ; KEY1=ACTD, DEACTIVATE RA (CANCEL ACTIVATION)
    GOTO PIR_SET_FIN
    PIR_TST_ACT
    BTFSC 1FH,4
    GOTO PIR_SET_FIN ; KEY1=ACTD, NO CHANGES IN RA (ACTIVATE VERIFIED)
    MOVFF 12H,PORTA ; KEY1=DEAC, ACTIVATE RA (CANCEL DEACTIVATION)
    GOTO PIR_SET_FIN
    PIR_SET_FIN
    MOVFF PORTA,12H
    GOTO PIR_KEY1_INI
    PIR_EXIT ; TRANSMIT PIR SETTINGS TO 877A
    BSF STATUS,RP0
    BCF PORTB,4
    BCF PORTB,7
    BCF STATUS,RP0
    BCF PORTB,4 ; TRIGGER BY RB4=0
    BSF PORTB,7 ; TURN ON ALARM
    CALL DELAY_FFX
    CALL DELAY_FFX ; END TRANSMIT PIR SETTINGS TO 877A
    CLRF 1FH
    BSF STATUS,RP0
    MOVLF 77H,PORTB ; ROW4 OF KEYPAD
    BCF STATUS,RP0
    CALL TST_MRK_BZR
    BCF PORTB,3
    GOTO TRGR_PND_OPT
    PIR_LEDS_DEC
    MOVLF 0FH,PORTA
    CALL DELAY_FFX
    MOVLF 07H,PORTA
    CALL DELAY_FFX
    MOVLF 03H,PORTA
    CALL DELAY_FFX
    MOVLF 01H,PORTA
    CALL DELAY_FFX
    CLRF PORTA
    GOTO PIR_LEDS
    ;--------------------------------------------------------------------
    ; PRESSED 0, CHANGE PWD2
    CHANGE_PWD
    BCF 1FH,5
    CALL CPWD_LEDS
    CHANGE_PWD_MAIN
    CALL ASK_PWD
    BTFSS 1DH,5 ; TEST FOR CANCEL
    GOTO CHANGE_PWD_KY ; PWD INPUT NOT CANCELLED
    MOVF 11H,1 ; # PRESSED, CANCEL
    BTFSS STATUS,Z
    GOTO CHANGE_PWD_CI ; CANCEL INPUTS
    GOTO CHANGE_PWD_CNCL ; NO PREVIOUS INPUTS, CANCEL OPTION
    CHANGE_PWD_CI
    CLRF 11H ; CLEAR INPUT COUNTER
    BCF 1DH,1
    CALL INPUT_MNTR ; UPDATE INDICATORS
    GOTO CHANGE_PWD_MAIN
    CHANGE_PWD_KY
    BTFSS 1DH,2
    GOTO CHANGE_PWD_MAIN ; DID NOT REACH 4 INPUTS YET, WAIT FOR INPUT
    BTFSS 1FH,6 ; 4 INPUTS ALREADY
    GOTO CONFIRM_PWD ; STORE NEW PWD IN RAM, NO CONFIRMATION YET
    BCF 1FH,6
    CALL VERIFY_PWD
    BTFSS 1DH,3
    GOTO CHANGE_PWD_CNCL ; UNCONFIRMED NEW PWD, CANCEL OPTION
    GOTO CONFIRMED_PWD ; CONFIRMED NEW PWD
    CONFIRM_PWD ; CONFIRM NEW PWD MARKER
    CALL NEW_PWD_SAVE
    BSF 1FH,6
    GOTO CHANGE_PWD_MAIN
    CONFIRMED_PWD
    CALL CPWD_LEDS
    CLRF 12H
    CLRF 11H
    CLRF PORTA
    WRITE_NEW_PWD ; WRITE NEW PWD (17H-1AH) TO EEPROM
    CLRF 26H
    MOVLF 17H,FSR ; INITIALIZE POINTER
    WRITE_EEPROM
    MOVFF 26H,EEADR ; EEPROM ADR
    MOVFF INDF,EEDATA ; EEPROM DATA
    BSF STATUS,RP0 ; START OF WRITE
    BCF INTCON,GIE ; DISABLE INTERRUPTS
    BCF EECON1,RD ; DISABLE EEPROM READ
    BSF EECON1,WREN ; ENABLE WRITE
    MOVLF 55H,EECON2 ; REQUIRED WHEN WRITING
    MOVLF 0AAH,EECON2 ; REQUIRED WHEN WRITING
    BSF EECON1,WR ; BEGIN WRITE
    TST_EEWRITE
    BTFSC EECON1,WR ; TEST IF FINISHED WRITING
    GOTO TST_EEWRITE ; STILL WRITING
    BCF EECON1,WREN ; FINISHED WRITING, VERIFY
    BSF EECON1,RD
    BCF STATUS,RP0
    SUBFF EEDATA,INDF ; READ CURRENT EEPROM ADR
    BTFSC STATUS,Z
    GOTO NXT_WRITE ; CORRECT DATA WRITTEN TO EEPROM
    GOTO WRITE_CANCEL ; ERROR IN WRITING DATA, CANCEL
    NXT_WRITE
    INCF FSR,1
    INCF 26H,1
    BTFSS 26H,2
    GOTO WRITE_EEPROM ; CONTINUE TO WRITE
    GOTO WRITE_COMPLETE ; FINISHED 4 WRITES
    WRITE_COMPLETE
    BSF STATUS,RP0
    BCF EECON1,RD ; DISABLE EEPROM READ
    BCF STATUS,RP0
    BSF PORTB,7
    CALL CPWD_LEDS
    BCF PORTB,7
    GOTO CHANGE_PWD_FIN
    WRITE_CANCEL ; DETERMINE NUMBER OF CORRECTLY WRITTEN TO EEPROM
    MOVF 26H,1
    BTFSS STATUS,Z
    GOTO WRITE_ERROR2_TST ; NOT IN 1ST
    MOVLF 00H,28H ; ERROR IN 1ST, BLINK ALL
    GOTO WRITE_ERR_IND
    WRITE_ERROR2_TST
    SUBLF 01H,26H
    BTFSS STATUS,Z
    GOTO WRITE_ERROR3_TST ; NOT IN 2ND
    MOVLF 01H,28H ; ERROR IN 2ND, BLINK 3
    GOTO WRITE_ERR_IND
    WRITE_ERROR3_TST
    SUBLF 02H,26H
    BTFSS STATUS,Z
    GOTO WRITE_ERROR4 ; NOT IN 3RD
    MOVLF 03H,28H ; ERROR IN 3RD, BLINK 2
    GOTO WRITE_ERR_IND
    WRITE_ERROR4 ; ERROR IN 4TH
    MOVLF 07H,28H ; BLINK 1
    GOTO WRITE_ERR_IND
    WRITE_ERR_IND
    MOVLF 05H,27H
    BSF PORTB,7
    MOVFF 28H,PORTA
    WRITE_ERR_LP
    DECFSZ 27H,1
    GOTO WRITE_ERR_PTN
    BCF PORTB,7
    GOTO CHANGE_PWD_CNCL
    WRITE_ERR_PTN
    CALL DELAY_FFX
    CALL DELAY_FFX
    MOVLF 0FFH,PORTA
    CALL DELAY_FFX
    CALL DELAY_FFX
    MOVFF 28H,PORTA
    GOTO WRITE_ERR_LP
    CHANGE_PWD_CNCL
    CLRF 12H
    CLRF 11H
    CLRF PORTA
    CALL LEDS_CPWD_CNCL
    BTFSC 1FH,5 ; RESTORE OLD PWD
    CALL RELOAD_OLD_PWD ; OLD PWD TRANSFERRED
    GOTO CHANGE_PWD_FIN ; OLD PWD NOT YET TRANSFERRED
    CHANGE_PWD_FIN
    BCF 1DH,7
    CLRF 1FH
    BSF STATUS,RP0
    MOVLF 77H,PORTB ; ROW4 OF KEYPAD
    BCF STATUS,RP0
    CALL TST_MRK_BZR
    BCF PORTB,3
    GOTO TRGR_PND_OPT
    ;================================================= ===================
    ; TO BE CALLED
    ;--------------------------------------------------------------------
    ;************************************************* *******************
    ;--------------------------------------------------------------------
    DELAY_FX
    MOVLF 08H,0EH
    DLY_LOOP
    DECFSZ 0EH,1
    GOTO D0
    GOTO RETN
    D0 MOVLF 04H,0CH
    D1 DECFSZ 0CH,1
    GOTO D2
    GOTO DLY_LOOP
    D2 MOVLF 0FFH,0DH
    D3 DECFSZ 0DH,1
    GOTO D3
    GOTO D1
    RETN RETURN
    ;--------------------------------------------------------------------
    ;************************************************* *******************
    ;--------------------------------------------------------------------
    DELAY_FFX
    MOVLF 0FFH,1EH
    DLY_LOOP2
    DECFSZ 1EH,1
    GOTO D02
    GOTO RETN2
    D02 MOVLF 04H,0CH
    D12 DECFSZ 0CH,1
    GOTO D22
    GOTO DLY_LOOP2
    D22 MOVLF 0FFH,0DH
    D32 DECFSZ 0DH,1
    GOTO D32
    GOTO D12
    RETN2 RETURN
    ;--------------------------------------------------------------------
    ;************************************************* *******************
    ;--------------------------------------------------------------------
    TST_MRK_BZR ; TEST IF MARKER FOR WRONG PWD IS HIGH
    TST_1DH0
    BTFSS 1DH,0
    GOTO TST_1DH0_0
    TST_1DH0_1
    BSF PORTB,7
    GOTO TST_MRK_RET
    TST_1DH0_0
    BCF PORTB,7
    GOTO TST_MRK_RET
    TST_MRK_RET
    RETURN
    ;--------------------------------------------------------------------
    ;************************************************* *******************
    ;--------------------------------------------------------------------
    KEYPAD ; SCAN KEYPAD
    ROW1 BSF STATUS,RP0
    MOVLF 7EH,PORTB
    BCF STATUS,RP0
    CALL TST_MRK_BZR
    BCF PORTB,0
    R1C1 CALL DELAY_FX
    BTFSC PORTB,4
    GOTO R1C2
    MOVLW 01H ;OUT=1
    GOTO OUT
    R1C2 CALL DELAY_FX
    BTFSC PORTB,5
    GOTO R1C3
    MOVLW 02H ;OUT=2
    GOTO OUT
    R1C3 CALL DELAY_FX
    BTFSC PORTB,6
    GOTO ROW2
    MOVLW 03H ;OUT=3
    GOTO OUT
    ROW2 BSF STATUS,RP0
    MOVLF 7DH,PORTB
    BCF STATUS,RP0
    CALL TST_MRK_BZR
    BCF PORTB,1
    R2C1 CALL DELAY_FX
    BTFSC PORTB,4
    GOTO R2C2
    MOVLW 04H ;OUT=4
    GOTO OUT
    R2C2 CALL DELAY_FX
    BTFSC PORTB,5
    GOTO R2C3
    MOVLW 05H ;OUT=5
    GOTO OUT
    R2C3 CALL DELAY_FX
    BTFSC PORTB,6
    GOTO ROW3
    MOVLW 06H ;OUT=6
    GOTO OUT
    ROW3 BSF STATUS,RP0
    MOVLF 7BH,PORTB
    BCF STATUS,RP0
    CALL TST_MRK_BZR
    BCF PORTB,2
    R3C1 CALL DELAY_FX
    BTFSC PORTB,4
    GOTO R3C2
    MOVLW 07H ;OUT=7
    GOTO OUT
    R3C2 CALL DELAY_FX
    BTFSC PORTB,5
    GOTO R3C3
    MOVLW 08H ;OUT=8
    GOTO OUT
    R3C3 CALL DELAY_FX
    BTFSC PORTB,6
    GOTO ROW4
    MOVLW 09H ;OUT=9
    GOTO OUT
    ROW4 BSF STATUS,RP0
    MOVLF 77H,PORTB
    BCF STATUS,RP0
    CALL TST_MRK_BZR
    BCF PORTB,3
    R4C1 CALL DELAY_FX
    BTFSC PORTB,4
    GOTO R4C2
    MOVLW 0AH ;OUT=10/*
    GOTO OUT
    R4C2 CALL DELAY_FX
    BTFSC PORTB,5
    GOTO R4C3
    MOVLW 0BH ;OUT=11/0
    GOTO OUT
    R4C3 CALL DELAY_FX
    BTFSC PORTB,6
    GOTO NONE
    MOVLW 0CH ;OUT=12/#
    GOTO OUT
    NONE MOVLW 00H ;NO PRESSED KEY
    GOTO OUT
    OUT MOVWF 10H
    RETURN
    ;--------------------------------------------------------------------
    ;************************************************* *******************
    ;--------------------------------------------------------------------
    ASK_PWD ; ASK FOR PWD, REQUIRES INPUT_MNTR
    CALL KEYPAD ; GET INPUT FROM KEYPAD
    BTFSS 1FH,7
    GOTO ASK_PWD_CONT ; DONT COUNT KEYPAD SCAN
    DECFSZ 29H,1 ; MUST COUNT KEYPAD SCAN
    GOTO ASK_PWD_CONT
    BCF 1FH,7 ; TIME-OUT OCCURRED
    CLRF 11H ; CLEAR INPUT COUNTER
    BCF 1DH,1
    CALL INPUT_MNTR ; UPDATE INDICATORS
    GOTO KEY_RET
    ASK_PWD_CONT
    MOVF 10H,1 ; 10H = PRESSED KEY
    BTFSC STATUS,Z
    GOTO ASK_PWD ; NO KEY PRESSED, WAIT FOR INPUT
    GOTO DET_KEY ; PRESSED A KEY, DETERMINE IF CANCEL OR DEL A NUMBER
    DET_KEY
    SUBLF 0CH,10H
    BTFSC STATUS,Z
    GOTO KEY_PND ; PRESSED #
    GOTO KEY_NOT_PND ; PRESSED NOT #
    KEY_PND ; PRESSED #, CANCEL INPUTS
    CLRF 11H ; CLEAR INPUT COUNTER
    BCF 1DH,1
    CALL INPUT_MNTR ; UPDATE INDICATORS
    BTFSS 1DH,4 ; TEST FOR OPTION MODE
    GOTO ASK_PWD ; WAIT FOR INPUT, NOT IN OPTION MODE
    BSF 1DH,5 ; OPTION MODE, PWD CANCEL
    GOTO KEY_RET
    KEY_NOT_PND ; PRESSED NOT #
    SUBLF 0AH,10H
    BTFSC STATUS,Z
    GOTO KEY_STK ; PRESSED *
    GOTO KEY_NUMBR ; PRESSED NOT # AND *
    KEY_STK
    MOVF 11H,1
    BTFSC STATUS,Z
    GOTO ASK_PWD ; PRESSED * BUT NO PREVIOUS INPUT
    GOTO DEC_INP_CNT ; PRESSED * WITH PREVIOUS INPUT, DECREMENT COUNT
    DEC_INP_CNT
    DECF 11H,1
    BCF 1DH,1
    CALL INPUT_MNTR ; UPDATE INDICATORS
    GOTO ASK_PWD
    KEY_NUMBR
    BSF 1DH,1
    CALL INPUT_MNTR ; INCREMENT INPUT COUNTER AND CHANGE INDICATORS
    KEY_RET
    RETURN
    ;--------------------------------------------------------------------
    ;************************************************* *******************
    ;--------------------------------------------------------------------
    INPUT_MNTR ; INCREMENT INPUT COUNTER AND/OR CHANGE INDICATORS
    BTFSC 1DH,1
    INCF 11H,1
    COUNT_XXXX
    MOVF 11H,1
    BTFSC STATUS,Z
    GOTO COUNT_0 ; NO INPUTS YET
    GOTO COUNT_1 ; WITH INPUTS ALREADY
    COUNT_0
    CLRF PORTA ; TURN OFF INDICATORS
    CLRF 12H ; BACK-UP OF INDICATORS
    GOTO MNTR_OUT
    COUNT_1
    SUBLF 01H,11H
    BTFSS STATUS,Z
    GOTO COUNT_2 ; COUNT NOT 0,1
    MOVLF 01H,PORTA ; INDICATOR
    MOVLF 01H,12H ; BACK-UP
    MOVFF 10H,13H ; TRANSFER INPUT TO 1ST OF PWD
    GOTO MNTR_OUT
    COUNT_2
    SUBLF 02H,11H
    BTFSS STATUS,Z
    GOTO COUNT_3 ; COUNT NOT 0,1,2
    MOVLF 03H,PORTA ; INDICATOR
    MOVLF 03H,12H ; BACK-UP
    MOVFF 10H,14H ; TRANSFER INPUT TO 2ND OF PWD
    GOTO MNTR_OUT
    COUNT_3
    SUBLF 03H,11H
    BTFSS STATUS,Z
    GOTO COUNT_4 ; COUNT NOT 0,1,2,3
    MOVLF 07H,PORTA ; INDICATOR
    MOVLF 07H,12H ; BACK-UP
    MOVFF 10H,15H ; TRANSFER INPUT TO 3RD OF PWD
    GOTO MNTR_OUT
    COUNT_4
    SUBLF 04H,11H
    BTFSS STATUS,Z
    GOTO COUNT_5 ; COUNT NOT 0,1,2,3,4
    MOVLF 0FH,PORTA ; INDICATOR
    MOVLF 0FH,12H ; BACK-UP
    MOVFF 10H,16H ; TRANSFER INPUT TO 4TH OF PWD
    CLRF 11H ; CLEAR COUNTER
    CALL DELAY_FFX ; DELAY
    CALL DELAY_FFX
    CLRF PORTA ; CLEAR INDICATORS
    CLRF 12H ; CLEAR INPUT COUNTER
    BSF 1DH,2 ; VERIFY PWD (MARKER)
    GOTO MNTR_RET
    COUNT_5 ; WILL NOT OCCUR
    MNTR_OUT ; INPUTS < 4
    CALL DELAY_FFX
    CALL DELAY_FFX
    CLRF PORTA
    BCF 1DH,2 ; DO NOT VERIFY PWD YET
    MNTR_RET
    RETURN
    ;--------------------------------------------------------------------
    ;************************************************* *******************
    ;--------------------------------------------------------------------
    VERIFY_PWD ; COMPARE INPUT AND CORRECT PWD
    BTFSC 1DH,7
    GOTO CHK_0 ; CHANGE PWD MODE, READ FROM RAM ONLY
    GOTO PWD_EEPROM ; CHECK PWD USING DATA IN EEPROM
    ;--------------------------------------------------------------------
    PWD_EEPROM
    CLRF 26H ; ADR COUNTER, EEPROM ADR
    MOVLF 17H,FSR ; DESTINATION STARTING ADR, DESTINATION POINTER
    READ_EEPROM
    BTFSS 26H,2 ; UP TO 4 READS ONLY
    GOTO READ_EEPROM_CONT
    BSF STATUS,RP0 ; END OF READ
    BCF EECON1,RD
    BCF STATUS,RP0
    GOTO CHK_0
    READ_EEPROM_CONT
    MOVFF 26H,EEADR
    BSF STATUS,RP0
    BSF EECON1,RD
    BCF STATUS,RP0
    MOVFF EEDATA,INDF
    INCF FSR,1
    INCF 26H,1
    GOTO READ_EEPROM
    ;--------------------------------------------------------------------
    CHK_0
    SUBFF 13H,17H
    BTFSS STATUS,Z
    GOTO WRONG_PWD
    CHK_1 SUBFF 14H,18H
    BTFSS STATUS,Z
    GOTO WRONG_PWD
    CHK_2 SUBFF 15H,19H
    BTFSS STATUS,Z
    GOTO WRONG_PWD
    CHK_3 SUBFF 16H,1AH
    BTFSS STATUS,Z
    GOTO WRONG_PWD
    CHK_4 CLRF 1CH ; CORRECT PWD, CLEAR ATTEMPT COUNTER
    CLRF PORTA
    BCF PORTB,7 ; DISABLE ALARM
    BCF 1DH,0 ; REMOVE 3RD ATTEMPT MARKER
    BSF 1DH,3 ; CORRECT PWD MARKER
    GOTO VERIFY_OUT
    ; ONE INPUT IS WRONG
    WRONG_PWD
    BCF 1DH,3 ; INCORRECT PWD MARKER
    BTFSC 1DH,0
    GOTO WRNG_PWD_BZR ; ALARM ALREADY ON
    BTFSC 1DH,4
    GOTO WRNG_PWD_OPTION ; IN OPTION MODE
    INCF 1CH,1 ; INCREMENT WRONG PWD COUNTER
    SUBLF 01H,1CH ; DETERMINE NO. OF ATTEMPTS
    BTFSC STATUS,Z
    GOTO ATTEMPT_1 ; 1ST ATTEMPT
    SUBLF 02H,1CH ; NOT 1ST ATTEMPT
    BTFSC STATUS,Z
    GOTO ATTEMPT_2 ; 2ND ATTEMPT
    SUBLF 03H,1CH ; NOT 1ST, 2ND ATTEMPT
    BTFSC STATUS,Z
    GOTO ATTEMPT_3 ; 3RD ATTEMPT
    GOTO VERIFY_OUT ; NOT 1ST, 2ND, 3RD ATTEMPT (WILL NOT OCCUR)
    ATTEMPT_1
    MOVLF 01H,PORTA
    BCF 1DH,0
    GOTO ATTEMPT_IND
    ATTEMPT_2
    MOVLF 03H,PORTA
    BCF 1DH,0
    GOTO ATTEMPT_IND
    ATTEMPT_3
    MOVLF 07H,PORTA
    BSF 1DH,0 ; SET INDICATOR OF 3RD ATTEMPT
    CLRF 1CH ; CLEAR COUNTER
    GOTO ATTEMPT_IND
    ATTEMPT_IND
    BSF PORTB,7
    CALL DELAY_FFX
    CALL DELAY_FFX
    CLRF PORTA
    CALL TST_MRK_BZR
    GOTO VERIFY_OUT
    WRNG_PWD_BZR
    BSF PORTB,7
    BSF 1DH,0
    CLRF 1CH
    GOTO VERIFY_OUT
    WRNG_PWD_OPTION
    CLRF 1CH
    GOTO VERIFY_OUT
    VERIFY_OUT
    RETURN
    ;--------------------------------------------------------------------
    ;************************************************* *******************
    ;--------------------------------------------------------------------
    LEDS_TRGR_MAIN
    MOVLF 0FH,PORTA
    CALL DELAY_FFX
    MOVLF 00H,PORTA
    CALL DELAY_FFX
    MOVLF 0FH,PORTA
    CALL DELAY_FFX
    MOVLF 00H,PORTA
    RETURN
    ;--------------------------------------------------------------------
    LEDS_RA3N0
    MOVLF 09H,PORTA
    CALL DELAY_FFX
    CLRF PORTA
    RETURN
    ;--------------------------------------------------------------------
    LEDS_IN_PWD
    MOVLF 01H,PORTA
    CALL DELAY_FFX
    MOVLF 02H,PORTA
    CALL DELAY_FFX
    MOVLF 04H,PORTA
    CALL DELAY_FFX
    MOVLF 08H,PORTA
    CALL DELAY_FFX
    CLRF PORTA
    CALL DELAY_FFX
    MOVLF 01H,PORTA
    CALL DELAY_FFX
    MOVLF 03H,PORTA
    CALL DELAY_FFX
    MOVLF 07H,PORTA
    CALL DELAY_FFX
    MOVLF 0FH,PORTA
    CALL DELAY_FFX
    CLRF PORTA
    RETURN
    ;--------------------------------------------------------------------
    CPWD_LEDS
    MOVLF 02H,21H
    CPWD_LEDS_DEC
    DECFSZ 21H,1
    GOTO CPWD_LEDS_PTN
    GOTO CPWD_LEDS_EXT
    CPWD_LEDS_PTN
    MOVLF 01H,PORTA
    CALL DELAY_FFX
    MOVLF 00H,PORTA
    CALL DELAY_FFX
    MOVLF 01H,PORTA
    CALL DELAY_FFX
    MOVLF 02H,PORTA
    CALL DELAY_FFX
    MOVLF 00H,PORTA
    CALL DELAY_FFX
    MOVLF 02H,PORTA
    CALL DELAY_FFX
    MOVLF 04H,PORTA
    CALL DELAY_FFX
    MOVLF 00H,PORTA
    CALL DELAY_FFX
    MOVLF 04H,PORTA
    CALL DELAY_FFX
    MOVLF 08H,PORTA
    CALL DELAY_FFX
    MOVLF 00H,PORTA
    CALL DELAY_FFX
    MOVLF 08H,PORTA
    CALL DELAY_FFX
    CLRF PORTA
    GOTO CPWD_LEDS_DEC
    CPWD_LEDS_EXT
    RETURN
    ;--------------------------------------------------------------------
    LEDS_CPWD_CNCL
    MOVLF 02H,21H
    LEDS_CPWD_CNCL_DEC
    DECFSZ 21H,1
    GOTO LEDS_CPWD_CNCL_PTN
    GOTO LEDS_CPWD_CNCL_EXT
    LEDS_CPWD_CNCL_PTN
    MOVLF 09H,PORTA
    CALL DELAY_FFX
    MOVLF 06H,PORTA
    CALL DELAY_FFX
    MOVLF 00H,PORTA
    CALL DELAY_FFX
    MOVLF 09H,PORTA
    CALL DELAY_FFX
    MOVLF 06H,PORTA
    CALL DELAY_FFX
    MOVLF 00H,PORTA
    CALL DELAY_FFX
    GOTO LEDS_CPWD_CNCL_DEC
    LEDS_CPWD_CNCL_EXT
    RETURN
    ;--------------------------------------------------------------------
    ;************************************************* *******************
    ;--------------------------------------------------------------------
    PIR_CHK_KEY ; CHECK FOR VALID INPUT
    BCF 1FH,0
    BCF 1FH,1
    BCF 1FH,3
    BTFSS 1FH,2
    GOTO PIR_INP1
    GOTO PIR_INP2
    PIR_INP1
    SUBLF 01H,10H
    BTFSS STATUS,Z
    GOTO PIR_CHK_KEY2
    BTFSS PORTA,0 ; VALID INPUT
    GOTO PIR_RA00
    GOTO PIR_RA01
    PIR_RA00
    BSF PORTA,0
    BSF 1FH,4
    GOTO PIR_VALID
    PIR_RA01
    BCF PORTA,0
    BCF 1FH,4
    GOTO PIR_VALID
    PIR_CHK_KEY2
    SUBLF 02H,10H
    BTFSS STATUS,Z
    GOTO PIR_CHK_KEY3
    BTFSS PORTA,1 ; VALID INPUT
    GOTO PIR_RA10
    GOTO PIR_RA11
    PIR_RA10
    BSF PORTA,1
    BSF 1FH,4
    GOTO PIR_VALID
    PIR_RA11
    BCF PORTA,1
    BCF 1FH,4
    GOTO PIR_VALID
    PIR_CHK_KEY3
    SUBLF 03H,10H
    BTFSS STATUS,Z
    GOTO PIR_CHK_KEY4
    BTFSS PORTA,2 ; VALID INPUT
    GOTO PIR_RA20
    GOTO PIR_RA21
    PIR_RA20
    BSF PORTA,2
    BSF 1FH,4
    GOTO PIR_VALID
    PIR_RA21
    BCF PORTA,2
    BCF 1FH,4
    GOTO PIR_VALID
    PIR_CHK_KEY4
    SUBLF 04H,10H
    BTFSS STATUS,Z
    GOTO PIR_CHK_KEYC
    BTFSS PORTA,3 ; VALID INPUT
    GOTO PIR_RA30
    GOTO PIR_RA31
    PIR_RA30
    BSF PORTA,3
    BSF 1FH,4
    GOTO PIR_VALID
    PIR_RA31
    BCF PORTA,3
    BCF 1FH,4
    GOTO PIR_VALID
    PIR_VALID
    BSF 1FH,0 ; VALID INPUT MARKER
    MOVFF PORTA,20H ; PORTA W/ SELECTED PIR
    GOTO PIR_CHK_EXT
    PIR_CHK_KEYC
    SUBLF 0CH,10H
    BTFSS STATUS,Z
    GOTO PIR_CHK_EXT ; OTHER KEYS, NOT VALID
    GOTO PIR_CHK_CNCL ; # PRESSED, EXIT
    PIR_CHK_CNCL
    BSF 1FH,1
    GOTO PIR_CHK_EXT
    PIR_INP2
    PIR_CHK_KEYA
    SUBLF 0AH,10H
    BTFSS STATUS,Z
    GOTO PIR_CHK_KEYB
    BSF 1FH,3 ; * PRESSED, ACTIVATE
    BCF 1FH,1
    BSF 1FH,0
    GOTO PIR_CHK_EXT
    PIR_CHK_KEYB
    SUBLF 0BH,10H
    BTFSS STATUS,Z
    GOTO PIR_CHK_KEYC
    BCF 1FH,3 ; 0 PRESSED, DEACTIVATE
    BCF 1FH,1
    BSF 1FH,0
    GOTO PIR_CHK_EXT
    PIR_CHK_EXT
    BCF 1FH,2
    RETURN
    ;--------------------------------------------------------------------
    ;************************************************* *******************
    ;--------------------------------------------------------------------
    NEW_PWD_SAVE
    BSF 1FH,5 ; STORE NEW PWD IN RAM MARKER
    MOVFF 17H,22H ; TRANSFER OLD PWD
    MOVFF 18H,23H ; CURRENT PWD TO TEMP OLD PWD
    MOVFF 19H,24H
    MOVFF 1AH,25H
    MOVFF 13H,17H ; TRANSFER NEW PWD
    MOVFF 14H,18H ; NEW PWD (READ FROM KEYPAD) TO CURRENT PWD
    MOVFF 15H,19H
    MOVFF 16H,1AH
    RETURN
    RELOAD_OLD_PWD
    BCF 1FH,5
    MOVFF 22H,17H
    MOVFF 23H,18H
    MOVFF 24H,19H
    MOVFF 25H,1AH
    RETURN
    ;================================================= ===================
    END

  9. #9
    about dy ni xa sa duha ka security system.. fire alarm as well burglar alarm with password.. and password ky para mahibaw.an if ikaw bah jud ang tag.iya or dli... salamat kaau guys.... hope mka.tabang moh...

  10. #10
    unsa na part may wa masabti? naa man mga comments sa code..... aw...unsa dy problema ani?
    naglibog ka sa instruction set? like BCF, BSF,SUBLF, etc?

    refer lang ari para ana....
    PIC microcontroller - Wikipedia, the free encyclopedia

  11.    Advertisement

Page 1 of 4 123 ... LastLast

Similar Threads

 
  1. Replies: 0
    Last Post: 03-19-2013, 09:54 PM
  2. need your help all istorya bros and sis
    By bingkat in forum Business, Finance & Economics Discussions
    Replies: 35
    Last Post: 03-19-2011, 06:21 AM
  3. need your help regarding zipping of files using php
    By Saedecode in forum Programming
    Replies: 2
    Last Post: 01-22-2011, 07:09 PM
  4. Replies: 3
    Last Post: 10-03-2010, 03:36 PM
  5. hey guys i really need your HELP...PLEASE its urgent
    By Mr. Fernandez in forum Computer Hardware
    Replies: 31
    Last Post: 11-15-2006, 05:53 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
about us
We are the first Cebu Online Media.

iSTORYA.NET is Cebu's Biggest, Southern Philippines' Most Active, and the Philippines' Strongest Online Community!
follow us
#top