Matrix Keypad routine


Closed Thread
Results 1 to 40 of 135

Hybrid View

  1. #1
    Join Date
    Sep 2006
    Location
    Venezuela - Caracas
    Posts
    48


    Did you find this post helpful? Yes | No

    Default

    keypad complied 100%,
    but in terminal i receive many keys without press any key

    my test:

    Code:
    Include "modedefs.bas"
    INCLUDE "KeyPad.bas"  
    
    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        3        ' 3 COL keypad
    DEFINE KEYPAD_COL_PORT   PORTB    ' COL port = PORTB
    DEFINE KEYPAD_COL_BIT    1        ' COL0 = PORTB.1
    DEFINE KEYPAD_DEBOUNCEMS 200      ' debounce delay = 200 mSec
    DEFINE KEYPAD_AUTOREPEAT 0        ' use auto-repeat feature 
    
    Serial_Saida       Var     PORTC.2           'Pic 13  - >  Max232   10       
    myvar                    var byte
    
    Inicio:
        @ READKEYPAD _myvar
        Serout Serial_Saida, T2400, [#myvar, 13, 10] 
    goto Inicio

    Terrminal:

    Code:
    Received: 15
    Received: 15
    Received: 1
    Received: 3
    Received: 15
    Received: 15
    Received: 3
    Received: 2
    Received: 3
    ...... withou press any key

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


    Did you find this post helpful? Yes | No

    Default

    seems you forgot to add external pull-ups....

    i don't know wich pic you are using but try

    OPTION_REG.7=0
    Steve

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

  3. #3
    Join Date
    Sep 2006
    Location
    Venezuela - Caracas
    Posts
    48


    Did you find this post helpful? Yes | No

    Default

    i use 16f628a with pull-ups ..... for test

    in circuit row and col have voltage around 0,5 to 3,5v (oscillating ... i don't know why)

    than i press one button, 2 pins have 0,0v

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


    Did you find this post helpful? Yes | No

    Default

    Hi. While testing Steve's routine, I get many fatal errors. The attached Screen Capture gives the state. Steve if you can have a look...

    Includes are OK about names and paths.

    Ioannis
    Attached Images Attached Images  

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


    Did you find this post helpful? Yes | No

    Default

    Ioannis,
    You have to compile with MPASM, not PM.

    mpardinho,
    You probably miswired something. with your exact program it works fine here. Also.. there's no PORTC on PIC16F628 but you should already know that.

    i used this line for my config fuses
    Code:
    @   __CONFIG  _INTRC_OSC_NOCLKOUT & _MCLRE_OFF  &  _LVP_OFF & _WDT_OFF & _PWRTE_ON  & _BODEN_ON
    Did you tried with OPTION_REG.7=0 without resistor?

    wich value of pull-up?
    Steve

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

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


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by mister_e
    Ioannis,
    You have to compile with MPASM, not PM.
    Ohh! dear....

    Thanks,
    Ioannis

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


    Did you find this post helpful? Yes | No

    Default Mpasm > Pm

    Hello Steve,

    Any idea in getting your code to work (compile) with PM. ?

    That would be a big help.

    thank you for the shareing the code.

    regards

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