Matrix Keypad routine


Closed Thread
Results 1 to 40 of 135

Hybrid View

  1. #1
    Join Date
    Dec 2008
    Location
    Ploiesti, ROMANIA
    Posts
    582


    Did you find this post helpful? Yes | No

    Default Re: Need help desperately!!!

    How can I use this include for something like this ???
    Code:
    main:
    @ READKEYPAD _myvar
    gosub check
    goto main
    
    check:
    select case myvar
    
    case 1  
    porta.0 = 1 ; WHILE CASE 1 PORTA.0 = 1, THEN PORTA.0 = 0
    Thanks !

  2. #2
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,610


    Did you find this post helpful? Yes | No

    Default Re: Matrix Keypad routine

    Code:
    CASE 1  
      Porta.0 = 1
      WHILE myVar = 1
        @ READKEYPAD _myvar
      WEND
      PortA.0 = 0
    /Henrik.

  3. #3
    Join Date
    Dec 2008
    Location
    Ploiesti, ROMANIA
    Posts
    582


    Did you find this post helpful? Yes | No

    Default Re: Matrix Keypad routine

    Thank You!

    LE : But don't work.
    Press button 1 of matrix ; led 1 = OFF ; end pressing button 1 ; led 1 = ON untill press ANOTHER button ...say button 2.
    But pressing button 2 don't turn ON led2 ; just another press and release of button 2 turn correspondent led (2) ON.
    Attached Images Attached Images  
    Last edited by fratello; - 12th July 2015 at 18:39.

  4. #4
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,610


    Did you find this post helpful? Yes | No

    Default Re: Matrix Keypad routine

    In your first post you indicated that you wanted PortA.0 high while the myVar was equal to 1 - is that not what's happening with the code?
    How do you want it to work and what does the code look like?

  5. #5
    Join Date
    Dec 2008
    Location
    Ploiesti, ROMANIA
    Posts
    582


    Did you find this post helpful? Yes | No

    Default Re: Matrix Keypad routine

    Thanks for support , Mr.Henrik !
    What I want :
    - porta.x = ON while correspondent button.x is pressed.
    How work :
    - press button x ; do nothing ; release button x - porta.x=ON ; remain ON while press ANOTHER button(say y) ...But this new button(y) don't turn correspondent porta.y ON ; just turn OFF previous porta.x ; only after the release of the second press turn on correspondent porta.y...
    Attached Files Attached Files
    Last edited by fratello; - 12th July 2015 at 19:20.

  6. #6
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,610


    Did you find this post helpful? Yes | No

    Default Re: Matrix Keypad routine

    Hi,
    1) The documentations for the keypad routine says that myVar should be a BYTE, you have it declared as a WORD. Don't think it matters but ....
    2) There's no RETURN at the end of the Check subroutine.
    3) The routine has some sort of AutoRepeat feature, I don't know if that is perhaps messing with you - I've never used the routine myself.
    4) The filename for the INCLUDE file says Keypad1, have you modifed it in any way?
    5) Do you have your LED's wired as in the schematic? Ie PortA.1 = 1 does actually turn on the LED?

    Which device?

    /Henrik.

  7. #7
    Join Date
    Dec 2008
    Location
    Ploiesti, ROMANIA
    Posts
    582


    Did you find this post helpful? Yes | No

    Default Re: Matrix Keypad routine

    1.I (re) declared myVar as byte .
    2.I added Return at the end of check.
    3.I use this in my keypad include :
    " SINGLE_SCAN = 0 ; Scan ;till a key is pressed
    KEYPAD_AUTOREPEAT = 1 "
    4.No, just portb allocation
    5.Yes.
    No change in how the code work ...

    Thanks again !

    LE : "SINGLE_SCAN" must be set to "1" for acting like I wish ...
    Thanks ! Regards !
    Last edited by fratello; - 12th July 2015 at 20:15.

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