Using a PIC to program keypad?

Thread Starter

dooddyman

Joined Nov 5, 2013
2
Hello,

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
 

THE_RB

Joined Feb 11, 2008
5,438
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);
Rich (BB 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.
 

Art

Joined Sep 10, 2007
806
I just have got blank trying to think how to make the computer realize that certain number matches certain bits.
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.
 
Top