Using a PIC to program keypad?

Discussion in 'Programmer's Corner' started by dooddyman, Nov 5, 2013.

  1. dooddyman

    dooddyman Thread Starter New Member

    Nov 5, 2013

    I was learning PIC BASIC language along with assembly, then I came up to a project which requires inputs of external keypad and the aim is to change the state of a particular port when 4 subsequent inputs of the keypad matches with the programmed.

    In short, a lock system with 4 number password. Also in the project it asks to "inform" whether or the numbers pressed were correct or not.

    Do you have any suggestions? I just have got blank trying to think how to make the computer realize that certain number matches certain bits.

    Please help me on this one!

    Thank you
  2. THE_RB

    THE_RB AAC Fanatic!

    Feb 11, 2008
    Hi doodyman (hope you're not Arabic?!). :)

    It helps to draw out a flowchart, in a paint program or just on paper. This lets you create a procedure, simple and neat, without code writing getting in the way and confusing you. Once you know exactly what the proedure is, writing the code gets easy.

    Maybe a procedure a bit like this (psuedo code);
    if(new key is received)
      //first move previous inputs down
      d = c
      c = b
      b = a
      // add in new key
      a = new_key
      // test for a match
      if(a=='h' && b=='e' && c=='l' && d=='p') openlock()
    your flowchart procedure might also include a timeout period, or safety lockout after a bad 4digit code is entered etc.
  3. Art

    Art Well-Known Member

    Sep 10, 2007
    I think that means being stuck on the actual keypad scan routine
    (ie looking at bits on ports),
    but there are so many tutorials dealing with interfacing a pic with a keypad,
    I don't think it could be made any easier.
Similar Threads
Forum Title Date
Programmer's Corner Integrator program using borland C May 14, 2013
Programmer's Corner how to programme using pickit 3 Apr 8, 2012
Programmer's Corner How to Run and programme in MPLAB X using PICKit 3 Apr 7, 2012
Programmer's Corner Just a beginner in C.......very trivial program causing problem. Jul 14, 2011
Programmer's Corner Serial Programming using timer 2 for 8051 in C May 9, 2011

Share This Page