store numbers from keypad
WhipeOut
Posts: 13
I'm working on this pin code project, but I'm having some problems keeping the input data.
I'm using the SERIN command to get data from the keypad through a 4x20 LCD display.
I'd like to write a 4 digit pin code to the eeprom at the beginning of the program and name it pin_code or something (eks 1234)
Then I'd like to store the 4 digit input from the keypad as, let's say, pin_entered.
IF pin_code = pin_entered THEN granted
You get the point?
How can this be done??
Thanks..
I'm using the SERIN command to get data from the keypad through a 4x20 LCD display.
I'd like to write a 4 digit pin code to the eeprom at the beginning of the program and name it pin_code or something (eks 1234)
Then I'd like to store the 4 digit input from the keypad as, let's say, pin_entered.
IF pin_code = pin_entered THEN granted
You get the point?
How can this be done??
Thanks..
Comments
Play around with this rudimentary and incomplete program.
Saved_Pin var Byte(4)
Saved_Pin(0) = 1 'First digit of valid pin
Saved_Pin(1) = 2 'Second digit of valid pin
Saved_Pin(2) = 3 'Third digit of valid pin
Saved_Pin(3) = 4 'Fourth digit of valid pin
Pin_Number var byte(4)
SERIN PIN_NUMBER\4
For n =·0 to 3
IF Saved_Pin(n) = Pin_Number(n) then Next_Pin
Go to Bad_Pin
Next_Pin: Next
Pin_Okay:
.....
Bad_Pin:
----
END
Regards,
Bruce Bates
Post Edited (Bruce Bates) : 4/15/2005 5:23:27 AM GMT
As I said "play around with this rudimentary and incomplete program". If you want to make it more secure you can change it any way you choose to. The person entering the pin must enter all 4 digits, so they have no idea when or where the comparison failed.
PGP that brief routine is NOT!
I did make some changes to the original routine, however, to correct an array positioning error.
Bruce
If you had a "fixed" buffer of a specific width i.e 4 digits, simply roll out the last digit and roll in the new digit.
When the equivalent of "ENTER" had been pressed compare what is in the buffer.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Beau Schwabe - Mask Designer III
National Semiconductor Corporation
Latest Company News
(Communication Interface Division)
500 Pinnacle Court, Suite 525
Mail Stop GA1
Norcross,GA 30071
I'll check the functionality when it's time.
Thanks