+ Post New Thread
Results 1 to 11 of 11
  1. #1
    Newbie level 1
    Points: 694, Level: 5

    Join Date
    Jan 2009
    Posts
    1
    Helped
    0 / 0
    Points
    694
    Level
    5

    keypad و 74c922

    hello i want to write an assembly code for 8051 that do 4 main functions (+,-,*,/)
    now i can't read from keypad (4*4) and show on lcd !!

    does anyone have the assembly code for calculator?

    plz help me

    ( sorry if my English is not good!! )

    •   AltAdvertisement

        
       

  2. #2
    Advanced Member level 4
    Points: 7,067, Level: 20
    klystron's Avatar
    Join Date
    Jul 2002
    Location
    South Africa
    Posts
    1,014
    Helped
    192 / 192
    Points
    7,067
    Level
    20

    برنامه ال سی دی 8051

    Use the 74c922 keyboard decoder chip (with interupt line)



  3. #3
    Advanced Member level 2
    Points: 6,866, Level: 19
    ctownsend's Avatar
    Join Date
    Nov 2004
    Location
    Canada
    Posts
    574
    Helped
    94 / 94
    Points
    6,866
    Level
    19



    •   AltAdvertisement

        
       

  4. #4
    Junior Member level 3
    Points: 938, Level: 6

    Join Date
    Dec 2008
    Posts
    28
    Helped
    0 / 0
    Points
    938
    Level
    6

    cjne a,#07h




    •   AltAdvertisement

        
       

  5. #5
    Newbie level 3
    Points: 1,117, Level: 7

    Join Date
    Feb 2007
    Posts
    3
    Helped
    0 / 0
    Points
    1,117
    Level
    7

    keypad to 74c922

    I have c code for keypad and LCD



  6. #6
    Newbie level 3
    Points: 707, Level: 5

    Join Date
    Jan 2009
    Posts
    3
    Helped
    0 / 0
    Points
    707
    Level
    5

    74c922

    MOV P1,#0FH
    LP:
    MOV P1,#0FH
    KPD:
    MOV A,P1
    CJNE A,#0FH,DIS
    ACALL DELAY
    JMP KRL
    DIS:ACALL DELAY
    SJMP KPD
    KRL:MOV A,P1
    CJNE A,#0FH,NEXT
    ACALL DELAY
    SJMP KRL
    NEXT:ACALL SCANKEY
    ACALL DELAY
    SJMP LP
    SCANKEY:
    ACALL DELAY
    MOV P1,#0EFH
    MOV A,P1
    ANL A,#0FH
    CJNE A,#0FH,C1
    MOV P1,#0DFH
    MOV A,P1
    ANL A,#0FH
    CJNE A,#0FH,C2
    MOV P1,#0BFH
    MOV A,P1
    ANL A,#0FH
    CJNE A,#0FH,C3
    MOV P1,#7FH
    MOV A,P1
    ANL A,#0FH
    CJNE A,#0FH,C4
    POP 7BH
    MOV P1,#0FH
    LJMP LP
    C1:MOV DPTR,#TABLE1
    SJMP FINDROW
    C2:MOV DPTR,#TABLE2
    SJMP FINDROW
    C3:MOV DPTR,#TABLE3
    SJMP FINDROW
    C4:MOV DPTR,#TABLE4
    FINDROW:CJNE A,#0EH,N1
    MOV A,#0
    SJMP FIND
    N1:CJNE A,#0DH,N2
    MOV A,#1
    SJMP FIND
    N2:CJNE A,#0BH,N3
    MOV A,#2
    SJMP FIND
    N3:CJNE A,#07H,HERE
    MOV A,#3
    FIND:MOVC A,@A+DPTR
    RET
    TABLE1:DB 0F9H,99H,0F8H,8EH
    TABLE2:DB 0A4H,92H,80H,0C0H
    TABLE3:DB 0B0H,82H,90H,86H
    TABLE4:DB 088H,83H,0C6H,0A1H
    کافیه که یک برنامه برای تاخیر بنویسی
    ضمنا کیبورد به پورت یک وصل میشه بدون واسطه این برنامه آزمایش شده و مطمئن باش که جواب میده
    اگه مشکلی بود حتما بگو
    باید بگم که سایت های فارسی خیلی غنی تر اند
    [/url]



  7. #7
    Advanced Member level 2
    Points: 6,866, Level: 19
    ctownsend's Avatar
    Join Date
    Nov 2004
    Location
    Canada
    Posts
    574
    Helped
    94 / 94
    Points
    6,866
    Level
    19

    8051+lcd+keypad+assembly codes

    Quote Originally Posted by javad66
    MOV P1,#0FH
    LP:
    MOV P1,#0FH
    KPD:
    MOV A,P1
    CJNE A,#0FH,DIS
    ACALL DELAY
    JMP KRL
    DIS:ACALL DELAY
    SJMP KPD
    KRL:MOV A,P1
    CJNE A,#0FH,NEXT
    ACALL DELAY
    SJMP KRL
    NEXT:ACALL SCANKEY
    ACALL DELAY
    SJMP LP
    SCANKEY:
    ACALL DELAY
    MOV P1,#0EFH
    MOV A,P1
    ANL A,#0FH
    CJNE A,#0FH,C1
    MOV P1,#0DFH
    MOV A,P1
    ANL A,#0FH
    CJNE A,#0FH,C2
    MOV P1,#0BFH
    MOV A,P1
    ANL A,#0FH
    CJNE A,#0FH,C3
    MOV P1,#7FH
    MOV A,P1
    ANL A,#0FH
    CJNE A,#0FH,C4
    POP 7BH
    MOV P1,#0FH
    LJMP LP
    C1:MOV DPTR,#TABLE1
    SJMP FINDROW
    C2:MOV DPTR,#TABLE2
    SJMP FINDROW
    C3:MOV DPTR,#TABLE3
    SJMP FINDROW
    C4:MOV DPTR,#TABLE4
    FINDROW:CJNE A,#0EH,N1
    MOV A,#0
    SJMP FIND
    N1:CJNE A,#0DH,N2
    MOV A,#1
    SJMP FIND
    N2:CJNE A,#0BH,N3
    MOV A,#2
    SJMP FIND
    N3:CJNE A,#07H,HERE
    MOV A,#3
    FIND:MOVC A,@A+DPTR
    RET
    TABLE1:DB 0F9H,99H,0F8H,8EH
    TABLE2:DB 0A4H,92H,80H,0C0H
    TABLE3:DB 0B0H,82H,90H,86H
    TABLE4:DB 088H,83H,0C6H,0A1H
    کافیه که یک برنامه برای تاخیر بنویسی
    ضمنا کیبورد به پورت یک وصل میشه بدون واسطه این برنامه آزمایش شده و مطمئن باش که جواب میده
    اگه مشکلی بود حتما بگو
    باید بگم که سایت های فارسی خیلی غنی تر اند
    [/url]
    There is NOTHING worse than sloppy, uncommented code! Not even ONE comment. THE ONLY WAY someone can use this code is if they already know how to control an LCD display and interface a keypad in which case they don't need the code!!



  8. #8
    Newbie level 3
    Points: 707, Level: 5

    Join Date
    Jan 2009
    Posts
    3
    Helped
    0 / 0
    Points
    707
    Level
    5

    cjne 8051

    I already wrote this code and use it to interface 4*4kepad to 8051.
    with this code we can read a 4*4keypad and use for eny porpose. it just need to write a subroutin for "delay" that satisfy 10ms delay.
    evryone can use this code with confident that it work well.
    excusme aboat bad english.
    MOV P1,#0FH
    LP:
    MOV P1,#0FH
    KPD:
    MOV A,P1
    CJNE A,#0FH,DIS
    ACALL DELAY
    JMP KRL
    DIS:ACALL DELAY
    SJMP KPD
    KRL:MOV A,P1
    CJNE A,#0FH,NEXT
    ACALL DELAY
    SJMP KRL
    NEXT:ACALL SCANKEY
    ACALL DELAY
    SJMP LP
    SCANKEY:
    ACALL DELAY
    MOV P1,#0EFH
    MOV A,P1
    ANL A,#0FH
    CJNE A,#0FH,C1
    MOV P1,#0DFH
    MOV A,P1
    ANL A,#0FH
    CJNE A,#0FH,C2
    MOV P1,#0BFH
    MOV A,P1
    ANL A,#0FH
    CJNE A,#0FH,C3
    MOV P1,#7FH
    MOV A,P1
    ANL A,#0FH
    CJNE A,#0FH,C4
    POP 7BH
    MOV P1,#0FH
    LJMP LP
    C1:MOV DPTR,#TABLE1
    SJMP FINDROW
    C2:MOV DPTR,#TABLE2
    SJMP FINDROW
    C3:MOV DPTR,#TABLE3
    SJMP FINDROW
    C4:MOV DPTR,#TABLE4
    FINDROW:CJNE A,#0EH,N1
    MOV A,#0
    SJMP FIND
    N1:CJNE A,#0DH,N2
    MOV A,#1
    SJMP FIND
    N2:CJNE A,#0BH,N3
    MOV A,#2
    SJMP FIND
    N3:CJNE A,#07H,HERE
    MOV A,#3
    FIND:MOVC A,@A+DPTR
    RET
    TABLE1:DB 0F9H,99H,0F8H,8EH
    TABLE2:DB 0A4H,92H,80H,0C0H
    TABLE3:DB 0B0H,82H,90H,86H
    TABLE4:DB 088H,83H,0C6H,0A1H



  9. #9
    Newbie level 3
    Points: 382, Level: 4

    Join Date
    Nov 2010
    Posts
    3
    Helped
    0 / 0
    Points
    382
    Level
    4

    Re: keypad to 74c922

    Quote Originally Posted by rohailmalhi View Post
    I have c code for keypad and LCD
    Hi,
    If you don't mind. please upload the same. it'll be helpful for me



  10. #10
    Full Member level 4
    Points: 2,714, Level: 12
    Achievements:
    7 years registered
    g_shyam1682's Avatar
    Join Date
    Jan 2010
    Location
    Udaipur-Rajshan-India
    Posts
    206
    Helped
    53 / 53
    Points
    2,714
    Level
    12

    Re: lcd and keypad for 8051

    Hi arjungopinath

    If you have book
    "THE 8051 MICROCONTROLLER ARCHITECTURE, PROGRAMMING, & APPLICATIONS"
    Second Edition

    By, Kenneth J. Ayala

    Then open Chapter 10.

    It give LCD and Keypad assembly code with description.
    Read it.

    Hope this is help you.
    regard.
    Shyam



    •   AltAdvertisement

        
       

  11. #11
    Newbie level 3
    Points: 382, Level: 4

    Join Date
    Nov 2010
    Posts
    3
    Helped
    0 / 0
    Points
    382
    Level
    4

    Re: lcd and keypad for 8051

    Let me go through the book... tanks for the guidance.



--[[ ]]--