Kasabot ko gmay sa program pero naay tyms nga mg.libog ko f nganung ga.use ug BCF/ BTFSS/ ug BTFSC.. unsa may nakalahi nlaayaw kabalaka anang EEPROM. kay mao na'y sudlan sa imung data.
Anyways, asa man jud ani imu wa nasabtan d.i bro? unsa nga line?
Spoiler: Initialization sa PIC
Code:; 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 ;--------------------------------------------------------------------
Spoiler: Standby/Option Mode
Code: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 ;--------------------------------------------------------------------
Spoiler: Entering Password
Code: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 ;--------------------------------------------------------------------
Spoiler: What will happen if you enter the passwrd
Code: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 ;--------------------------------------------------------------------
Spoiler: Option Mode - to Arm the sensor, I guess, and change password
Code: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 ;--------------------------------------------------------------------
Naa na man siya mga comments bro. dali ra man sabtun especially, nag naming siya sa mga functions.
sir stealthghost..??