View Full Version : User Interfacing (memkey, lcd, keypad, BS2): Theory and Setup

09-27-2008, 07:42 AM
Yes I'm back with more questions. The more I learn the more I have, hopefully my·questions are becoming more in depth.
So here is what I am trying to figure out: How exactly do you setup a user interface with the BS2 for user defined values, values that will act as multipliers that will be necessary for the operation of a machine. As, always, I did a lot of reading and searching before posting and I am still a bit confused.
Here is what I would like to do. I would like to be able to set up a user interface using an LCD, memkey or other keypad encoder, bs2 module, and of course a keypad and some buttons. The tricky part is exactly how to setup the hardware and also the theory behind the code.
I am still working on a flowchart for the control process, but I have included a rough process chart describing what I’m trying to achieve.
Here are my questions.
1.)·· If a user inputs a value, let’s say (1-999) can that value then be used as variable for later equations? If so, what is the best way to achieve this? (commands)
2.)·· How would you set up the memkey to communicate with the BS2 and the LCD?
3.)·· What commands are most suited for this application so I can be reading up on those?
4.)·· Are there any examples, articles, etc. that I could look over?
Anyway, that should be good for now. I thank anyone willing to help and please let me know if I am unclear in my reasoning. Thanks

Mike Green
09-27-2008, 09:15 AM
1) What your program sees is a sequence of keypresses. You don't get a number automatically. You have to write the code to take the keypresses and produce a numeric value in some variable. There are Nuts and Volts Columns that discuss how to do this. It's not hard to do.
2) Read the MemKey documentation. It shows you how to use it with a Stamp. Read the LCD documentation. It shows you how to use it with a Stamp. Your program sits in between the two.
3) Look at the examples and see what commands they use. When you see a new command, learn about it.
4) There are lots of examples and articles. Go through the Nuts and Volts Columns. Go through the examples for the devices you plan to use. Make sure you understand the documentation for these. Go through some of the Stamps in Class tutorials. Be familiar with what the various tutorials cover.

09-27-2008, 09:17 AM
gth629e where runnig in a parallel universe.,I'am working on the same thing.Data in from a "keypad" w/ the MEMKey.The good thing about the MEMKey is it has a key pad "MEM" BUFFER. This can be called @ anytime to read the last keys pressed.you should clear this REG. after reading it, to make room for more KEYs....GOTO "down loads from "SOLUTIONS-CUBED".....Down load all the files for the MEMKey w/ BS2.....Note Start w/ AN302 and go from thier.If Your still havein problems/confused drop another post and I 'll send You some simple code to read a KEY PRESS from the MEMKey__$WMc%__

10-16-2008, 07:56 AM
Can anyone post a source code interfacing A MEMKEY with a BS2 (how to store data using a variable)?

10-16-2008, 10:11 AM
gth629e said...
If a user inputs a value, let’s say (1-999) can that value then be used as variable for later equations? If so, what is the best way to achieve this? (commands)

I think that you need to shift how you're thinking about this stuff. You've got input devices, a microprocessor, and output devices. It's all very general-purpose and what happens depends on the software that you write. The processor can detect things that happen to the input devices: you get to decide what those input events mean. You've got "IF-THEN" statements (and their relatives) to work with to assign certain values to variables dependent on what happens to those input devices.

Once those values are in those variables, you can do whatever you want with them - use 'em in equations, display them on output devices, use them to make decisions about how to control external devices, or even use them to modify how you handle other input events. They're yours to use however you please. You could write a program to read a mouse's position and use it to control which of several fans turns on. You could detect whether a button is pressed and use it to choose whether to use uppercase or lowercase characters on your LCD screen. Nothing is predefined. We get so used to certain input things doing certain output things that we forget that someone set up those relationships. Do you want the key labeled "3" to display the number "7" on your LCD when it's pressed? No problem - set it up in software. Do you want your debug terminal to display "black" when you type "white"? Again, no problem. This is why we use microprocessors.