+ Post New Thread
Results 1 to 5 of 5
  1. #1
    Advanced Member level 1
    Points: 5,813, Level: 18
    Maverickmax's Avatar
    Join Date
    Dec 2004
    Posts
    404
    Helped
    8 / 8
    Points
    5,813
    Level
    18

    Interface to 4x4 Keypad

    Hi

    I am struggling to interface my 4x4 Keypad as I connected 4 rows and columns to P0H to P0H7 respectively. I tried to scan it but I kept getting incorrect data. How can I scan the keypad correctly?

    I use column as output and row as input.

    Please advise me asap

    MM

    •   AltAdvertisement

        
       

  2. #2
    Full Member level 5
    Points: 3,185, Level: 13

    Join Date
    Feb 2007
    Location
    USA
    Posts
    260
    Helped
    35 / 35
    Points
    3,185
    Level
    13

    Re: Interface to 4x4 Keypad

    What is your reading sequence ?

    Added after 54 seconds:

    And the schematic

    Added after 2 hours 22 minutes:

    I imagine you are already doing the next:

    Initial column value = 0

    Set 1 to Column # 1
    Read the input - If data != 0 then you have key(s) pressed
    Set 0 to Column # 1

    Set 1 to Column # 2
    Read the input - If data != 0 then you have key(s) pressed
    Set 0 to Column # 2

    Set 1 to Column # 3
    Read the input - If data != 0 then you have key(s) pressed
    Set 0 to Column # 3

    Set 1 to Column # 4
    Read the input - If data != 0 then you have key(s) pressed
    Set 0 to Column # 4

    Delay to avoid bouncing



    •   AltAdvertisement

        
       

  3. #3
    Advanced Member level 1
    Points: 5,813, Level: 18
    Maverickmax's Avatar
    Join Date
    Dec 2004
    Posts
    404
    Helped
    8 / 8
    Points
    5,813
    Level
    18

    Re: Interface to 4x4 Keypad

    Since I set the columns high and rows as input but each row has a pull-up resistor. So the inputs of row would be high. When key is depressed, say 1. The software will carry algorithm such as setting column to zero one by one. For example:

    0111
    1011
    1101
    1110

    While key "1" is depressed and column number 1 set to zero which will override row 1 to zero. As button 1 releases, the 1st row will go back to one due to a pull-up resistor. Is that correct?

    MM



    •   AltAdvertisement

        
       

  4. #4
    Full Member level 5
    Points: 3,185, Level: 13

    Join Date
    Feb 2007
    Location
    USA
    Posts
    260
    Helped
    35 / 35
    Points
    3,185
    Level
    13

    Re: Interface to 4x4 Keypad

    If you have pull-up resistors you cannot set the column to 1 to read each row.

    But, to help you better, please send the schematics.



  5. #5
    Advanced Member level 3
    Points: 7,169, Level: 20

    Join Date
    Jan 2006
    Location
    Bangalore India
    Posts
    805
    Helped
    103 / 103
    Points
    7,169
    Level
    20
    Blog Entries
    1

    Interface to 4x4 Keypad - how to scan the keypad correctly?

    how to detect multiple keys in this confiugration
    Bangalore
    9986111439 {sms only}
    EMAIL REMOVED - READ THE FORUM RULES



--[[ ]]--