Keypad and DT's Instant Interrupts


Closed Thread
Results 1 to 12 of 12

Hybrid View

  1. #1
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    0-3 is 4 bits, so you have to configure to 4 COLUMNs.

    maybe 4 colums and 3 row now?

    on the other hand my comments in the code above are not right... sorry

    for a whole 4X4 keypad it should be
    Code:
        DEFINE KEYPAD_ROW 4 	 ' 4 ROW keypad
        DEFINE KEYPAD_ROW_PORT PORTB ' ROW port = PORTB
        DEFINE KEYPAD_ROW_BIT 4 	 ' ROW0 = PORTB.4
        DEFINE KEYPAD_COL 4 	 ' 4 COL keypad
        DEFINE KEYPAD_COL_PORT PORTB ' COL port = PORTB
        DEFINE KEYPAD_COL_BIT 0 	 ' COL0 = PORTB.0
        DEFINE KEYPAD_DEBOUNCEMS 20  ' debounce delay = 20 mSec
        DEFINE SCAN_ONCE 1
    i have this setup on a EASYPIC4 board and their 4X4 keypad like this


    And using the internal pull-up.

    their keypad schematic is bellow
    http://www.mikroe.com/pdf/keypad_board_schematic.pdf
    Last edited by mister_e; - 26th April 2007 at 20:18.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  2. #2
    Join Date
    Oct 2005
    Posts
    35


    Did you find this post helpful? Yes | No

    Thumbs up

    Corrected to:

    DEFINE KEYPAD_COL 4 ' 4 COL keypad (0-3)

    DEFINE KEYPAD_COL_BIT 0 ' COL 0 = PORTB.0 (wires start at PORTB bit 0)

    Keypad is now working properly.

    Many thanks for your attention and efforts.
    Thanks,
    Homerclese

  3. #3
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Cool

    Cool!

    Highlighted Code.
    Instant Interrupt Examples.
    And the solution to a problem with DT in the title.

    I think I'll just sit back and enjoy life for awhile.
    <br>
    DT

  4. #4
    Join Date
    Oct 2005
    Posts
    35


    Did you find this post helpful? Yes | No

    Question

    I have noticed that the keypad display output occurs on the release of the keypress. The setup I have which is like a "musical chairs" type of game requires variable index capture of the first player to be detected on "keypress". Can I change this?
    Also, in my old kepad routine I would lockout a team of 4 players who jumped the gun by removing that column from the scan, bit 0 in the example portion below.

    If penaltyflagA = 0 then ' good start
    PortB=%00001111
    butn = butn +4
    Goto PlayerB ' Pull the first row line LOW
    Else ' penalty for this player
    PortB=%00001110 ' remove this col from keypad scan for round

    Where is the best place in this keypad code to do the same?
    Last edited by Homerclese; - 27th April 2007 at 04:22.
    Thanks,
    Homerclese

  5. #5
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Darrel Taylor View Post
    Cool!

    Highlighted Code.
    Instant Interrupt Examples.
    And the solution to a problem with DT in the title.

    I think I'll just sit back and enjoy life for awhile.
    <table><tr><td>Yeah, everything in the same post... but... hum hum, you forgot Macro and INCLUDE :which i'm now converted to... it's all your fault </td><td></td></tr></table>

    Homer, can you post your whole code?
    Last edited by mister_e; - 27th April 2007 at 07:58.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts