EngineersGarage

  • Engineers Garage Main Site
  • Visit our active EE Forums
    • EDABoard.com
    • Electro-Tech-Online
  • Projects & Tutorials
    • Circuits
    • Electronic Projects
    • Tutorials
    • Components
  • Digi-Key Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • Advertise
You are here: Home / Topics / Assembly Language oF ELECRTONIC CODE LOCK PROJECT

Assembly Language oF ELECRTONIC CODE LOCK PROJECT

|

Microcontroller › 8051 › Assembly Language oF ELECRTONIC CODE LOCK PROJECT

  • This topic has 5 replies, 2 voices, and was last updated 14 years, 2 months ago by dagakshay.
Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • April 27, 2011 at 2:01 pm #886
    SaLMAN Ahmed Khan
    Participant

    HELLOO BROS !!! I HAVE A BIG BUGS IN MY PROGRAMING RELATED TO ELECTRONIC CODE LOCK THAT IS ALSO HERE  IN WEBSITE BUT I HAVE MADE WITH ASSEMBLY LANG.PLZ FINDOUT MY BUGS SPECIALLY ON KEYPAD PROGRAM

    BECAUSE AT THERE IM FACING PROBLEM..

     

     

     

     

     

     

     

     

    ;SALMAN AHMED KHAN 019 
     
     
     
     
    LCD     DATA     P2          ;define LCD data port on port 2
    KEYPAD  DATA     P0          ;define KEYPAD dataport on port 1
     
    ORG 00H
    MOV DPTR,#MYCOM
    SALMAN:
    CLR A 
    MOVC A,@A+DPTR
    JZ SEND_DATA
    ACALL COMNWRT ; ////CALL COMMAND FOR LCD
    ACALL DELAY
    INC DPTR
    SJMP SALMAN
     
    SEND_DATA:
    MOV DPTR,#MYDATA
    D1: CLR A                  
    MOVC A,@A+DPTR
    ACALL DATAWORD
    ACALL DELAY
    INC DPTR
    JZ AGAIN
    SJMP D1
    AGAIN:  SJMP AGAIN
    COMNWRT:
    MOV LCD,A
    CLR P1.0 ;//////////RS=0 FOR COMMAND
    CLR P1.1 ;//////////R/W=O FOR WRITE
    SETB P1.2;//////////E=1 FOR HIGH PULSE
     
    CLR P1.2;/////////// E=0 H TO L
    ACALL DELAY
    RET
    DATAWORD:
    MOV LCD,A
    SETB P1.0 ;//////////RS=0 FOR COMMAND
    //CLR P1.0 ;//////////R/W=O FOR WRITE
     
    SETB P1.2;//////////E=1 FOR HIGH PULSE    
    CLR P1.2;////////// enable is to set & then cleard when data/command to be WRITTEN! i.e H-to-L pulse to be given.
    ACALL DELAY
    RET
     
    DELAY:MOV R6,#100
    DL1: MOV R7,#10
    DJNZ R7,$
    DJNZ R6,DL1
    RET
     
     
    ;======SAVING PASSWORD IN MEMORY 0RG 200H======
    mov DPTR,#MYPASS
    sak:clr a
    movc A,@A+DPTR
    inc dptr
    jz keypad1
    sjmp sak
    ;========Interfacing Keypad====================
    keypad1:
    mov KEYPAD,#0FFH             ;make P1 an input port
    SAK2:   mov keypad,#00h ;ground all rows at onnce
           MOV A,KEYPAD                 ;read all col. (ensure all keys open)
           ANL A,00001111B          ;masked unused bits
           CJNE A,#00001111B,SAK2   ;check til all keys released
    SAK3:    ACALL DELAY            ;call 20 msec delay
           MOV A,KEYPAD               ;see if any key is pressed
           ANL A,#00001111B       ;mask unused bits
           CJNE A,#00001111B,OVER ;key pressed, await closure
           SJMP SAK3                ;check il key pressed
    OVER:  ACALL DELAY            ;wait 20 msec debounce time
           MOV A,KEYPAD               ;check key closure
           ANL A,#00001111B       ;mask unused bits
           CJNE A,#00001111B,OVER1;key pressed, find row
           SJMP SAK3                ;if none, keep polling
    OVER1: MOV KEYPAD,#11111110B      ;gound row 0
           ANL A,#00001111B       ;mask unused bits
           CJNE A,#00001111B,ROW_0;key row 0, find the col.
           MOV KEYPAD,#11111101B      ;ground row 1
           ANL A,#00001111B       ;mask unused bits
           CJNE A,#00001111B,ROW_1;keyrow 1, find the col.
           MOV KEYPAD,#11111011B      ;ground row 2
           ANL A,#00001111B       ;mask unused bits
           CJNE A,#00001111B,ROW_2;key row 2, find the col.
           MOV P1,#11110111B      ;ground row 3
           ANL A,#00001111B       ;mask unused bits
           CJNE A,#00001111B,ROW_3;keyrow 3, find the col.
           LJMP SAK3                ;if none, false input, repeat
    ROW_0: MOV DPTR,#KCODE0       ;set DPTR=start of row 0       
           SJMP FIND              ;find col. key belongs to
    ROW_1: MOV DPTR,#KCODE1       ;set DPTR=start of row 1
           SJMP FIND              ;find col. key belongs to
    ROW_2: MOV DPTR,#KCODE2       ;set DPTR=start of row 2
           SJMP FIND              ;find col. key belongs to
    ROW_3: MOV DPTR,#KCODE3       ;set DPTR=start of row 3
    FIND:  RRC A                  ;see if any CY bit low
           JNC MATCH              ;if zero, get the ASCII code      
           INC DPTR               ;point to next col. address
           SJMP FIND              ;keep searching
    MATCH: CLR A                  ;set A=0 (match is found)
           MOVC A,@A+DPTR         ;get ASCII code from table
           MOV P2,A             ;display pressed key
                         
            ACALL COMNWRT ; ////CALL COMMAND FOR LCD for displaying keypad      
    ACALL DATAWORD;
    LJMP SAK2 
    JZ MATCHPASSS
     
    MATCHPASSS:
    CJNE A,#2431,X1
    SEND_PASS:
      MOV DPTR,#MSG1
    D4:CLR A                   // ‘D1’ was written in thee previous line, making the dptr load with default value, thus error in commnad values
    MOVC A,@A+DPTR
    ACALL DATAWORD
    ACALL DELAY
    INC DPTR
    JZ AGAIN2
    sjmp D4
    AGAIN2:  SJMP AGAIN2
    RET
    X1:
      MOV DPTR,#MSG2
    D5:CLR A                   // ‘D1’ was written in thee previous line, making the dptr load with default value, thus error in commnad values
    MOVC A,@A+DPTR
    ACALL DATAWORD
    ACALL DELAY
    INC DPTR
    SJMP D5
    AGAIN1:  SJMP AGAIN1
    RET
    ACALL COMNWRT
    ACALL DATAWORD
    RET
     
     
    ;ASCII LOOK-UP TABLE FOR EACH ROW
     
          ORG     400H
    KCODE0: DB     ‘1’,’2′,’3′          ;ROW 0
    KCODE1: DB     ‘4’,’5′,’6′          ;ROW 1
    KCODE2: DB     ‘7’,’8′,’9′          ;ROW 2
    KCODE3: DB     ‘*’,’0′,’#’          ;ROW 3
    ORG 100H
    MYCOM: DB 38H,0FH,06H,02H,01H,0
    MYDATA: DB “ENTER PASSWORD”,0
    MYCOM1: DB 38H,0C0H,0FH,06H,01H,0
    ORG 200H
    MYPASS: DB “2431”,0
    org 500H
    MSG1: DB “CORRECT”
    MSG2: DB “WRONG”
    END
    April 28, 2011 at 5:59 am #6052
    dagakshay
    Participant

    hello salman…

    please do past the error you getting…

    i always feel c to be very easy language then the asm. but ya of effiency of code you can switch for asm.

    if you have a c code for the program just go to the link it might help you out…

    http://www.engineersgarage.com/forums/8051/c-code-assembly-code

     

    April 28, 2011 at 11:02 am #6056
    SaLMAN Ahmed Khan
    Participant

     

    helloo dagakshay

     

     well there is no errror in this prog when u run it on keil there is no error only bugsss because when i run this on PROTEUS it doesnt work accordin to theme…..if u could tell me in assembly that will be easy because the task given to me is to do programing iN aSSEMBLY……..

     

     

    April 29, 2011 at 5:12 am #6057
    dagakshay
    Participant

    hello salman,

    i don’t know asm code much…

    April 29, 2011 at 5:41 pm #6061
    SaLMAN Ahmed Khan
    Participant

    OK, HOW MUCH DELAY HAVE U GIVEN IN THIS TO LCD AND KEYPAD IN C LANG???

     

     

    April 30, 2011 at 6:51 am #6063
    dagakshay
    Participant

    hello salman these are not mine codes…

    do send the link i will lok at code and let you know

    i am a EG labs fan like you….

  • Author
    Posts
Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.
Log In

RSS Recent Posts

  • Does US electric code allow branching ? July 19, 2025
  • Faulty heat air gun (dc motor) - problem to locate fault due to Intermittent fault July 19, 2025
  • Fun with AI and swordfish basic July 19, 2025
  • Sump pit water alarm - Kicad 9 July 19, 2025
  • turbo jet fan - feedback appreciated. July 19, 2025

Stay Up To Date

Newsletter Signup
EngineersGarage

Copyright © 2025 WTWH Media LLC. All Rights Reserved. The material on this site may not be reproduced, distributed, transmitted, cached or otherwise used, except with the prior written permission of WTWH Media
Privacy Policy | Advertising | About Us

Search Engineers Garage

  • Engineers Garage Main Site
  • Visit our active EE Forums
    • EDABoard.com
    • Electro-Tech-Online
  • Projects & Tutorials
    • Circuits
    • Electronic Projects
    • Tutorials
    • Components
  • Digi-Key Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • Advertise