Matrix Keypad routine


Closed Thread
Results 1 to 40 of 135

Hybrid View

  1. #1
    Join Date
    Apr 2007
    Posts
    24


    Did you find this post helpful? Yes | No

    Default Is it not just? AND am I missing somthing?

    Hello all,

    I have to ask because I have NEVER seen it done any other way. But is it not just plain good design practice to current limit with series resistors and pull up or down ALL digital I/O's?

    And as far as driving your 220AC device. You should ALWAYS use some sort of isolation device to protect your DC circuits AND the poor person that is trying to use them!

    But back to the thread....

    Tell me if I am missing something here and if this would work at all:

    if doing a keypad scan could you not use portb 0-2 and portb 3-7 for a 3x4 keypad. then use a look up table to get the actual key pressed? If you could do this it would be easy to add "secret" key combinations to do special functions in the project.

    I am just getting started here and learning lots by reading. I have spent quite some time looking over the Keypad code posted here and its VERY complex more so then I would have thought. am I missing something here?
    (I am not saying anything bad about the code. I could just be ignorant to what it takes to actually do this. So please don't be insulted.)

    Also, I see no accomidation in the keypad for compairing the input from the keypad to stored values for say "pin access" or the such. Or is this code ment to be only the keyscan?

    Just asking?

    ;Smart A** Programing Joke starts here
    cls
    Print "Best Regards,"
    Print "Bill12780"
    end

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


    Did you find this post helpful? Yes | No

    Default

    Hi Bill,

    It's not that it really takes that much code to scan a keypad. You can write your own that's much simpler, (Except that YOU actually have to write it). And then it will probably only work with that one set of hardware that you wrote it for.

    But mister_e's keypad module was written to work with Everybody's program. With lots of options to allow the user to customize it to work with whatever hardware they are using, and with different modes such as Auto Repeat, and Scan Once, or Modal modes. Without the user having to do much at all.

    It looks complicated on the inside, but that's the part you don't need to worry about. All you have to deal with is the actual useage of the module. Which is really easy. Define your pins and desired features, use an @ READKEYPAD _KeyVar, and you're done.

    It's just like when you use PicBasic Pro itself. You don't care how the code works inside the compiler. You just want to say LCDOUT "Hello World" and have it show up on the LCD display.
    Also, I see no accomidation in the keypad for compairing the input from the keypad to stored values for say "pin access" or the such. Or is this code ment to be only the keyscan?
    Correct. Just reads the keypad.
    For some sample code that can recognize a sequence of key presses. This might help.

    Combinaton Gate access
    http://www.picbasic.co.uk/forum/showthread.php?t=5695
    DT

  3. #3
    Join Date
    Sep 2003
    Location
    INDIA
    Posts
    161


    Did you find this post helpful? Yes | No

    Default Single Port Pin

    Hello,

    I remember seeing an idea of connecting multiple (more than 1) switches on a single Port(analog) pin and working with the adc val.

    Cannot find this anymore on the forum.

    Any help on this topic/idea.

    regards

  4. #4
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    4,132


    Did you find this post helpful? Yes | No

    Default

    I don't remember where is the link, but you can do it easily just like that.

    From the analog port put some resistors in series to 5V. t the joints of the resistors put switch to ground. So every switch will result in different voltage at the ADC input. No switch pressed, the ADC will read 255 or 1023 (8 or 10 bit result).

    Ioannis

  5. #5
    Join Date
    Apr 2006
    Location
    New Hampshire USA
    Posts
    298


    Did you find this post helpful? Yes | No

    Post Scanning Many Keys With One Input

    Hi charudatt,
    Quote Originally Posted by charudatt View Post
    Hello,

    I remember seeing an idea of connecting multiple (more than 1) switches on a single Port(analog) pin and working with the adc val.

    Cannot find this anymore on the forum.

    Any help on this topic/idea.

    regards
    TIP #5 Scanning Many Keys With One Input
    EDIT: TIP #7 4x4 Keyboard with 1 Input

    Microchip’s Tips ‘n Tricks (DS40040C)
    http://ww1.microchip.com/downloads/e...Doc/40040C.pdf

    Hope this helps,
    -Adam-
    Last edited by Pic_User; - 3rd July 2007 at 14:25. Reason: Added TIP #7

  6. #6
    Join Date
    Sep 2003
    Location
    INDIA
    Posts
    161


    Did you find this post helpful? Yes | No

    Default Thanks

    Thank you Adam and Ioannis.

    That was exactly what I was looking for.

    regards

  7. #7
    Join Date
    Aug 2006
    Location
    Omaha, Nebraska USA
    Posts
    263


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by bill12780 View Post
    I have to ask because I have NEVER seen it done any other way. But is it not just plain good design practice to current limit with series resistors and pull up or down ALL digital I/O's?
    This is what I was taught back in the "old days", but there are lots of circumstantial exceptions--there were circumstantial exceptions, then, too, but probably not as many of them!
    Russ
    N0EVC, xWB6ONT, xWN6ONT

    "Easy to use" is easy to say.

Similar Threads

  1. calculator-like code entry with matrix keypad and display
    By Dennis in forum mel PIC BASIC Pro
    Replies: 35
    Last Post: - 16th December 2009, 22:58
  2. Need help in matrix keypad coding
    By rano_zen06 in forum mel PIC BASIC Pro
    Replies: 15
    Last Post: - 24th May 2008, 13:16
  3. I2C PCF8574 4X4 Keypad routine
    By RFsolution in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 28th January 2007, 21:25
  4. Inconsistent output on a 4x4 matrix keypad
    By markcadcam in forum mel PIC BASIC Pro
    Replies: 12
    Last Post: - 24th November 2006, 03:54
  5. very basic matrix keypad question
    By kitcat in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 8th July 2006, 21:33

Members who have read this thread : 2

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