absolute number
antonis
Posts: 9
hello to everybody!!!!!!!!
i have a numeric kaypad and i enter a 4-digit code.
i have a master code store in a variable and i want to compare with tha and if is thet to do an action
example:
master_code=1234
when i enter the 4-digits i entered one by one and stored in a temporary variable and transfered to eeprom
so ihave in four eeprom places one digit & one digit & one digit & one digit (1 & 2 & 3 & 4)
how i can saidto bs2 take that four digit put in one variable and compare?
thank you!
i have a numeric kaypad and i enter a 4-digit code.
i have a master code store in a variable and i want to compare with tha and if is thet to do an action
example:
master_code=1234
when i enter the 4-digits i entered one by one and stored in a temporary variable and transfered to eeprom
so ihave in four eeprom places one digit & one digit & one digit & one digit (1 & 2 & 3 & 4)
how i can saidto bs2 take that four digit put in one variable and compare?
thank you!
Comments
Rich H
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
The Simple Servo Tester, a kit from Gadget Gangster.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Think Inside the box first and if that doesn't work..
Re-arrange what's inside the box then...
Think outside the BOX!
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Engineering
·
using a rotating algorithm with 40 bytes could last ten lifetimes.
You should perhaps store the codes in eeprom and then store the input into ram space to compare though as Chris suggests. that way you can have many codes to compare input for different users for example.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Think Inside the box first and if that doesn't work..
Re-arrange what's inside the box then...
Think outside the BOX!
You're correct in that the likelihood of this particular use isn't likely to cause any issues in and of itself, it tells me that programmer is getting comfortable using the EEPROM in place of RAM which could cause problems in many other situations. If you develop your code to use the right resources the first time then you can re-use it later, comfortable in the knowledge that it will work. You also have to think of the possibility of there being an error in the switch input of code that causes data to be written in a continuous loop. It's the little things that I notice sometimes. Take care all.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Engineering
·
"...how i can saidto bs2 take that four digit put in one variable and compare?..."
Why not store the incoming keypad data in one 16-bit variable (WORD)? ... If you can keep the value of each 'key' between 0 and 15, then on each new keypress you can just shift the data left by one nibble and enter the new key on the least significant nibble.
Example Code
Note: on the first itteration the DEBUG window should say "WRONG CODE!!!" ... following that after a false or 'simulated' key pad entry the DEBUG window will display "Code Matches!!"
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Beau Schwabe
IC Layout Engineer
Parallax, Inc.
Post Edited (Beau Schwabe (Parallax)) : 6/7/2010 7:19:19 AM GMT
your post
Example Code
Note: on the first itteration the DEBUG window should say "WRONG CODE!!!" ... following that after a false or 'simulated' key pad entry the DEBUG window will display "Code Matches!!"
end of post
I'm not sure I understand why its getting the correct code...
How should it be wired?
Thanks in advance