| ??? 10/03/02 06:41 Read: times |
#30084 - Code for a 5-digit security pass-word |
I wrote this code below one year ago on a smaller project for a security sensor system. This time I am face with a similar situation but with an LCD screen to show (*) while the PW is being entered. Also wait until all 5 digits are enterd before determining whether the code is write or wrong. The old code is below:
DISARM: MOV A,P1 ;Entry Code into A. ANL A,#0FH ;Masking sensors. CJNE A,#8,ENTRY1 ;Check if first digit is right? AJMP ENTR12 ;Check sensors again. DISAM2: CJNE R4,#4,ENTRY1 ;Check if second digit is right? AJMP ENTR13 ;Check sensors again. DISAM3: CJNE R0,#0,ENTRY1 ;Check if 3rd digit is right? AJMP DIAMF ;Congratulations. ;******************************************** ;****************HERE COMES THE THE MAGICIAN**************************** ;*********DISPLAYING ZONES (without system being ARMED****************** DISP1: SETB P3.2 ;Display 4. CJNE A,#0E0H,N_Z1 ;If another ZONE is trigger, ;clear this ZONE on the display. SJMP DISP1 ;Otherwise, continue to display 4. N_Z1: CLR P3.2 ;Clear 4 on display. LJMP JONE1 ;Back to monitoring home. DISP2: MOV 0B0H,#03 ;Display 3. CJNE A,#0D0H,N_Z2 ;If another ZONE is trigger, ;clear this ZONE on the display. SJMP DISP2 ;Otherwise, continue to display 3. N_Z2: MOV 0B0H,#00H ;Clear display. (clear port 3). LJMP ZONE1 ;Back to monitoring home. DISP3: SETB P3.1 ;Display 2. CJNE A,#0BH,N_Z3 ;If another ZONE is trigger, ;clear this ZONE on the display. SJMP DISP3 ;Otherwise, continue to display 2. N_Z3: CLR P3.1 ;clear 2 on dispaly. LJMP ZONE1 ;Back to monitoring home. DISP4: SETB P3.0 ;Display 1. CJNE A,#70H,N_Z4 ;If another ZONE is trigger, ;clear this ZONE on the display. SJMP DISP4 ;Otherwise, continue to display 1. N_Z4: CLR P3.0 ;Clear display. LJMP ZONE1 ;Back to monitoring zones. ;******************************************** ;****************CHECKING FOR CORRECT CODE******************************* ENTR12: MOV A,P1 ;check for correct 2nd code. ANL A,#0FH ;Masking off sensors. CJNE A,#4,ENTRY1 ;Check Zone 1 else, Zone 2. MOV R4,A ;content of A in R4 LJMP DISAM2 ;continue check of correct code. ENTR13: MOV A,P1 ;checking for correct 3rd code. ANL A,#0FH ;Masking off sensors. CJNE A,#00,ENTRY1 ;Check Zone 2 else, Zone 3. MOV R0,A ;A contents in R0. LJMP DISAM3 ;Check for correct final code. The last time I was using an 8051 and now I am using a ROMless 80c31 with an external EEPROM also 20 by 4 line LCD. Please help with the code. |
| Topic | Author | Date |
| Code for a 5-digit security pass-word | 01/01/70 00:00 | |
RE: Code for a 5-digit security pass-word | 01/01/70 00:00 |



