4x4 KeyPad Project
jayzdaboss
Posts: 18
I just need help programming my BASIC STAMP so I can see what I'm clicking on the keypad on the 7 segment LED for a pass code entry system. The list below is the parts list.
List:
4x4 KeyPad - http://www.parallax.com/StoreSearchResults/tabid/768/txtSearch/keypad/List/0/SortField/4/ProductID/739/Default.aspx
7-Segment LED Display - http://www.parallax.com/StoreSearchResults/tabid/768/txtSearch/7/List/0/SortField/4/ProductID/388/Default.aspx
1K Resister
If you can help that will be great.
List:
4x4 KeyPad - http://www.parallax.com/StoreSearchResults/tabid/768/txtSearch/keypad/List/0/SortField/4/ProductID/739/Default.aspx
7-Segment LED Display - http://www.parallax.com/StoreSearchResults/tabid/768/txtSearch/7/List/0/SortField/4/ProductID/388/Default.aspx
1K Resister
If you can help that will be great.
Comments
Have you tried the demo code on the keypad product page?
The book "What's a Microcontroller" (a free pdf version is available) will help you get going on being able to use input and send output (to the 7-segment display) using the BS2.
I'm trying to do a pass code entry system and im trying to get keypad to enter the code and i have no idea how im suppose to code that.
They're below \/\/\/\/\/\/
Phil has written a little tutorial on how to post code in the forum. Here's his link.
You can also use code blocks to post the output from the Stamp's debug window.
I think you can copy and paste text from the debug window into the forum editor window.
I don't have the Basic Stamp editor installed on this computer. As I've mentioned before, I generally use Propellers in my projects.
Is the code you posted the original demo program, or have you modified it?
Did it work the way it's supposed to? (I shouldn't have to ask this.)
What Basic Stamp board/kit are you using? What Basic Stamp books do you have? Have you learned to use the Basic Stamp to light a LED?
Have you found an example of using the 7-segment display with a BS2 yet?
I've modified it to work with the pass code portion of the code but it seems that when i tip something it doesn't enter it to the password
No it doesn't work the way its suppose to.
This is the kit i have: http://www.parallax.com/Store/Microcontrollers/BASICStampProgrammingKits/tabid/136/CategoryID/11/List/0/SortField/0/Level/a/ProductID/789/Default.aspx
and yes i have learned to use the BASIC STAMP to light a LED.
Yes i just dont know how to integrate the code so when i press 1 on the key pad it will show up on the 7- segment display
You did miss one question.
I found an example on page 165 of WAM v2.2.
Have you gone through (entered the code and ran the programs and also tried the variations they suggest) this example?
Can you enter a number in the terminal and have it show up on the 7-segment display?
With your keypad code, can you press a key and have it show up in the debug window?
If you can answer yes to the two last questions, you should be close to your goal of pressing a key (on the keypad) and having it show up on the 7-segment display.
I noticed they use 1000 Ohm resistors and not 470 Ohm to light the 7-segment display. I'd use the 1000 Ohm resistors as the book suggests.
Does the original demo code work?
Is your problem with the part you've modified?
no i cant
no it dosent show up on the debug i think theres something i need to at or remove for it to show up on the debug
i use 1k Ohms as well
yes the demo dose work but not with the pass code entry
the part i modified dont show anything on the debug
im kinda stumped lol
I keep hoping someone who uses the BS2 will jump in to help.
jayzdaboss, Please don't make me work so hard to try to help. I don't want to go back through my earlier post to see what answer goes with which question. "no i cant" doesn't tell me much.
Please provide more detail about what you can and can't do with the Basic Stamp so far.
Is your goal the same as your original post of wanting the key you press to display with the 7-segment?
Basically I'm guessing there's something amiss with your wiring or the row column mapping on the keypad. Also posting a high res picture of your setup may help.
The data from the keypad is a binary word with one bit for each key, whereas the data required by the keypad decoder is a string of ascii codes. A crucial step is to make the translation from one form to the other. I don't see that in the code you posted. Have you done that? There would be several ways to approach it, but the one that comes to mind uses the
value = NCD keypad
operator to change the keypad variable into an integer from 1 to 16, followed by a
LOOKUP value-1,["D#0*C9.........."],userEntry
to convert that to the ascii code corresponding to each key.
when i use the demo they work fine and im just customing the demo for my own use
No i haven't done that. That's what I'm stuck on the coding for the translation.
Once you know the program is decoding the correct ascii characters, it will be possible to merge it into the passcode routine. The above routine provides debouncing, in the sense that each character printed requires that you have to press and release a key. The decoding step translates the keypad result into one of 16 ascii codes. You can look up the LOOKUP instruction in the Stamp manual, also the NCD operator. Don't hesitate to ask for clarification and help for a next step after you play around with it a bit.
I just need help with this peace because all it right when I tip in the keypad is D.
If your native language is not English, I understand, but more information about what you tried and what worked or didn't work will help to resolve the problem.
I don't have your keypad set up, but I did try out the decoding part, as follows:
In the program I posted above, I had forgotten to include the square brackets around the [ "D#0*C987B654A321"]
What ever I click on the key pad it shows up as a "D" in the debug. It is my native language i was just half asleep when i wrote it.
I found that out when I saw it.
Why do I need to put a - 1 ?
The lookup has the form, There should not be commas between the letters. The -1 is necessary because the value of NCD keypad will be zero when no key at all is pressed, and 1 when the key attached to "D" is pressed, 2 for "#" etc.. The "D" is at offset zero in the string.
I stuck in a changed DEBUG too, so that you can see also what the keypad value is as well as the ascii code, to help with debugging.
thanks
If you do that would be a great help.
binary-password-lock.
creating-a-password-combo-with-Pushbuttons