All About Circuits Forum  

Go Back   All About Circuits Forum > Software, Microcomputing, and Communications Forums > Programmer's Corner

Notices

Programmer's Corner Discussion forum for all aspects of programming and software engineering. Any software programming language welcome: C, C++, C#, Fortran, Java, Matlab, etc.

Reply   Post New Thread
 
Thread Tools Display Modes
  #1  
Old 11-05-2013, 11:22 PM
dooddyman dooddyman is offline
New Member
 
Join Date: Nov 2013
Posts: 2
Default Using a PIC to program keypad?

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
Reply With Quote
  #2  
Old 11-06-2013, 02:20 AM
THE_RB's Avatar
THE_RB THE_RB is offline
Senior Member
 
Join Date: Feb 2008
Posts: 5,225
Default

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);
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()
}
Select All
your flowchart procedure might also include a timeout period, or safety lockout after a bad 4digit code is entered etc.
__________________
Roman Black - PICs and electronics. Author of BTc PIC-sound encoder, Shift1-LCD project, the TalkBotBrain talking PIC controller, LiniStepper open-source microstepping motor driver, the Black Regulator 2-transistor SMPS, and probably some other stuff; www.RomanBlack.com
Reply With Quote
  #3  
Old 11-06-2013, 06:08 AM
Art Art is offline
Senior Member
 
Join Date: Sep 2007
Posts: 519
Default

Quote:
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.
Reply With Quote
Reply   Post New Thread

Tags
, ,


Related Site Pages
Section Title
Worksheet Sum-of-Products and Product-of-Sums expressions
Worksheet Boolean algebra
Worksheet Microcontroller principles
Worksheet Digital display circuits
Worksheet Karnaugh mapping
Worksheet Numeration systems
Worksheet Class A BJT amplifiers
Worksheet Mixed-frequency signals
Textbook Parallel-in, parallel-out, universal shift register : Shift Registers
Textbook Serial-in, parallel-out shift register : Shift Registers


Similar Threads
Thread Thread Starter Forum Replies Last Post
8051 keypad interfacing C Program problem shubham161 Embedded Systems and Microcontrollers 2 07-22-2012 03:01 PM
PIC compiling problem electronic_noob Embedded Systems and Microcontrollers 13 02-06-2010 11:10 AM
WILL $$$$ PAY FOR HELP WRITING THIS PROGRAM !!!!!!!!!!! Z80 nocmsa Programmer's Corner 0 11-23-2008 03:40 AM
Using a PIC to decode a 23 button keypad Sophtware Embedded Systems and Microcontrollers 2 10-04-2006 12:41 PM

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 01:07 PM.


User-posted content, unless source quoted, is licensed under a Creative Commons Public Domain License.
Powered by vBulletin
Copyright ©2000 - 2014, vBulletin Solutions, Inc.