Inconsistent output on a 4x4 matrix keypad


Closed Thread
Results 1 to 13 of 13

Hybrid View

  1. #1
    Join Date
    Feb 2006
    Location
    Ohio
    Posts
    29


    Did you find this post helpful? Yes | No

    Default

    I'll give it a try.

    Thanks,
    Mark

  2. #2
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    4,115


    Did you find this post helpful? Yes | No

    Default

    If you still have problem after Steve's suggestions, please check the circuits. Better send the circuit here to see how you connected the buttons to the PIC. I suspect noise from some lines.

    Ioannis

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


    Did you find this post helpful? Yes | No

    Default

    FYI, using his code, i had similar problem as markcadam, so i decide to use my 'easy to use' INCLUDE with the same PIC and crystal... confirm that my hardware was good (EasyPIC4 + Keypad 4X4 adapter). Worked with internal pull-up AND external (of course).

    Then i worked around his code. Use LATB intead of PORTB to write to the port for safety sake. On a whole port write, it doesn't really matter.. but when you write to few bit .. it may cause some problem. In this case leaving PORTB AS IS, will work anyways.

    Writing to PORT before TRIS is also for safety sake even if some don't believe it But if you leave it like this... it still working.. but sometimes you have some screwed values

    BUT the real magic is in the @ nop. remove those lines and the readings are screwed up.. or intermittent. just by this famous PIC18Xxxxx feature called 'Read/Modify/write' behaviour.

    18Fs are much noise sensitive.. so i would avoid to use internal weak-pull-ups... IMHO.. you know i hate those anyways
    Last edited by mister_e; - 23rd November 2006 at 07:51.
    Steve

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

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


    Did you find this post helpful? Yes | No

    Default

    mmm, just double/triple/quad check the whole thing...
    it appear that the TRIS work better if before the PORT/LATB line ....DOH!

    BUT if you want to use the 'Microchip says' approach (write to PORT before TRIS), replace @ nop by @ GOTO $+2

    That way... it works ... a treat

    M.F.Sorry!
    Last edited by mister_e; - 23rd November 2006 at 08:15.
    Steve

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

  5. #5
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    4,115


    Did you find this post helpful? Yes | No

    Default

    Hi Steve. Doesn't @ GOTO $+2 being equal to jump to next instruction? Also the same as NOP. So whats the difference?

    Ioannis

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


    Did you find this post helpful? Yes | No

    Default

    ASM GOTO need 2 cycle to execute, NOP only 1 cycle
    Steve

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

  7. #7
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    4,115


    Did you find this post helpful? Yes | No

    Default

    Yeap. You are right. Its a typical delay then...

    Ioannis

Similar Threads

  1. Matrix Keypad routine
    By mister_e in forum Code Examples
    Replies: 134
    Last Post: - 18th September 2022, 20:30
  2. 4x4 keypad Help
    By aaliyah1 in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 5th October 2010, 16:34
  3. Need help in matrix keypad coding
    By rano_zen06 in forum mel PIC BASIC Pro
    Replies: 15
    Last Post: - 24th May 2008, 13:16
  4. Serious Serial Situation Setbacks...
    By Dansdog in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 7th February 2007, 03:46
  5. I2C PCF8574 4X4 Keypad routine
    By RFsolution in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 28th January 2007, 21:25

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