10x4 matrix keyboard using only portB


Closed Thread
Results 1 to 20 of 20

Hybrid View

  1. #1
    Join Date
    May 2008
    Location
    Italy
    Posts
    825


    Did you find this post helpful? Yes | No

    Default 60 keys matrix keypad

    During the weekend I came to the conclusion that the project should be for 60 keys.
    The reason is that it is simpler to workout a smaller keypad from a larger one. (at least in this case)

    Just remove the unnecessary switches and diodes and you have the keypad already designed.

    The software has also been changed a bit in order to work around the fact that 16F84A could not accomodate an array of 61 bytes.
    So with this new solution I had it at work reducing also the code work space.

    Now the software works with all combination of keypad from 4x1 to 4x15 (Rows x Columns)

    I am attaching the file with the new version (Hardware & Software) sure that this will make life easier.
    Al.
    Attached Images Attached Images
    Last edited by aratti; - 17th November 2008 at 21:56.
    All progress began with an idea

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


    Did you find this post helpful? Yes | No

    Default

    Hi Aratti,

    You're doing a good job here, but there are a couple issues I'd like to bring up.
    Don't shoot me.

    While scanning the first row, you set PortB =16 which puts RB4 high and RB5-7 low.

    <img src="http://www.picbasic.co.uk/forum/attachment.php?attachmentid=3010" /><!-- Name:  KeypadShort.JPG
Views: 4058
Size:  18.2 KB -->

    If someone accidentally presses keys 1.1 and 2.1 at the same time, you have a dead short across RB4 and RB5. If you have a small power supply it won't last long because the PIC will reset as soon as the voltage drops low enough. But if you have a strong power supply, somethings likely to smoke.

    The problem can be overcome a couple ways, either by adding ~100 ohm resistors in series with each Row's pin. Or you can manipulate the TRIS register in your program instead of PORTB, and only allow 1 Row at a time to be in OUTPUT mode.

    And, it would be allot nicer to have the Outputs on the lower bits of PORTB, and the Inputs on RB4-7.

    Then you would be able to use the PortB Change interrupts to monitor the keypad, and you wouldn't have to keep scanning it all the time. You would then place all outputs to HIGH and when you get an interrupt, scan the rows 1 by 1 like normal.

    HTH,
    DT

  3. #3
    Join Date
    May 2008
    Location
    Italy
    Posts
    825


    Did you find this post helpful? Yes | No

    Default

    Thank you Darel to have pointed out the problem, which I did noticed! I will modify the software to have only one output pin at the time on portB. The updated version will be posted tomorrow.

    Thank againg for your promp notification.

    Kind regards

    Al.
    All progress began with an idea

  4. #4
    Join Date
    May 2008
    Location
    Italy
    Posts
    825


    Did you find this post helpful? Yes | No

    Default

    Here the updated version of software and hardware.

    It was necessary to pulldown the rows as well (4x5K resistors) in order to avoid floating inputs. It has been tested and it works.

    If you have downloaded the file from the previuos post please discard them and download the updated file from this post.

    Thank you again to Darel, and sorry for the inconvenience to all the members of the forum that have visited my post.

    Al.
    Attached Images Attached Images
    Last edited by aratti; - 18th November 2008 at 13:16.
    All progress began with an idea

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


    Did you find this post helpful? Yes | No

    Default

    I like the concept, good job!
    Steve

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

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


    Did you find this post helpful? Yes | No

    Default

    Awwwwww! No RBC Interrupts. :(

    Such a nice little keypad scheme.
    If only it would ....
    <br>
    DT

  7. #7
    Join Date
    May 2008
    Location
    Italy
    Posts
    825


    Did you find this post helpful? Yes | No

    Default

    Darel be patient next release will be with "PORTB change interrupts". For that I need to build a new hardware prototype and it will take few days.
    I had to fix the bug you pointed out quickly, otherwise I could not sleep!

    Regards

    Al.
    All progress began with an idea

  8. #8


    Did you find this post helpful? Yes | No

    Default

    If I am looking at this correctly, the one drawback to this design is that you can't detect multiple keypresses in the sam row, right? In fact, holding two keys down in the same row could cause the wrong character code to be generated. Like holding down 1,1,and 1,8 gives you the code for 1,9, right? Not trying to nitpick. Just wanted to make sure I understood the advantages and disadvantages to the design.
    Tim Barr

  9. #9
    Join Date
    May 2008
    Location
    Italy
    Posts
    825


    Did you find this post helpful? Yes | No

    Default

    Yes Tim, this is the price you have to pay for the extra keys!

    If the spacing of the keypad is done properly than chances to press two contiguous keys at the same time are really rare, but since number of keys available is no more an issue, you can dedicate one key to delate the possible unwanted input.

    Al.
    All progress began with an idea

Similar Threads

  1. PICs can do more if use others than delays instructions
    By hardcore in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 24th February 2010, 19:52
  2. AT/PS2 Keybord - PIC Interface?
    By Kamikaze47 in forum Code Examples
    Replies: 73
    Last Post: - 9th August 2009, 16:10
  3. shifting problem
    By helmut in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 31st August 2007, 06:11
  4. Output PIC module
    By freelancebee in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 12th September 2005, 20:10
  5. Can anyone help a beginner in a struggle?
    By douglasjam in forum mel PIC BASIC
    Replies: 1
    Last Post: - 5th May 2005, 23:29

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