Shop OBEX P1 Docs P2 Docs Learn Events
Making a switch interface keyboard — Parallax Forums

Making a switch interface keyboard

mfavs327mfavs327 Posts: 11
edited 2007-10-31 13:48 in BASIC Stamp
I was wondering if there was someone who could help me out with a school project that I have to do.· I am making a five button keyboard where the first four buttons are going to be characters and the fifth button will change the characters.· An example of this is the first four buttons will be A, S, D and F but when you hit the fifth button the first four buttons will now become J, K, L and ;.· The way i was going to do this is have the fifth button attach to a counter and everytime you press the switch the counter will send a 4 bit binary code to 4 different mux's these mux's each have 12 computer characters attach to it. I was wondering if the basic stamp can create those characters (a-z, 0-9, arrow buttons and others) that when the 4 bit binary code goes into the mux it selects one of the characters to send out.· Im using the MC10E164 Mux and the MC14516BCP counter.· If someone has a better way of setting this up or have any suggestions or help they can give me that would be great since its my senior project that i have to do for disabled people at the nashua center.

Comments

  • MorrolanMorrolan Posts: 98
    edited 2007-10-24 09:57
    Can the 5th button not be a simple latch-on/latch-off switch? That makes things easier.

    Can you not use a Stamp? That would make it a WHOLE lot easier! tongue.gif

    Using a Stamp you can do:

    5 buttons = 5 input pins. Use the Stamp to build a string, then send to whatever you need to send to (debug, LCD etc)

    Very little circuitry involved and the maths is simple. Make pin 5 increment a counter. If you press button four, change the relevant bit, i.e. it is now 0001 etc. Convert to a decimal, and add button 5's unique value (1000, 2000, 3000 for each time it is pressed etc) and each possible decimal value will have a character associated with it. Easy.

    Going back to the circuit method, have you looked at using a cheap 4017 decade counter to help track your button presses of your "shift" key? Another way might be shift-registers I think.

    Sorry I couldn't be more help!

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Flying is simple. You just throw yourself at the ground and miss.

    "I think computer viruses should count as life. I think it says something about human nature that the only form of life we have created so far is purely destructive. We've created life in our own image."
    Stephen Hawking
  • Bruce BatesBruce Bates Posts: 3,045
    edited 2007-10-24 11:02
    mfavs -

    Although not a complete scheme as shown, here is where my immediate thinking takes me. The iteration number below represents the Nth pressing of the fifth key, where N is the iteration.
    There is a direct relationship between any ASCII character and its decimal representation. So, by way of example, if you want the first iteration of a number of key presses to represent ABCD and the second iteration to be EFGH consider the following:

    · Key···· ASCII Value· Decimal· Hex··· Iteration
    Pressed Of Key Press··· Value· Value

    ·First··············· A·············· 65····· 41········ 0
    ·Second··········· B·············· 66····· 42········ 0
    · Third············· C·············· 67····· 43········ 0
    ·Fourth············ D·············· 68······ 44······· 0

    ·First··············· E·············· 69······ 45········ 1
    ·Second··········· F·············· 70······ 46······· 1
    · Third············· G·············· 71······ 47······· 1
    ·Fourth············ H·············· 72······ 48········ 1

    ·First··············· I··············· 73······ 49······· 2
    ·Second··········· J··············· 74······ 4A······ 2
    · Third············· K··············· 75······ 4B······ 2
    ·Fourth············ L··············· 76····· ·4C······ 2

    Looking at the decimal values, and the iterations, as well as the beginning value of the table, the decimal value is predictable knowing which key is pressed and which iteration it represents.

    - - -
    I hope that provides a line of thought without getting too overly involved. It's prior to my first cup of coffee, so I hope it's clear enough.

    Regards,

    Bruce Bates
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2007-10-24 16:52
    My route would be to build a DATA table just as if you were scanning a matrix keypad. Your values would be stored 4 x n where n is the number of different virtual rows you have. By default row 0 would be selected and the key pressed would be an offset from the start of DATA. Each time the fifth key was pressed 4 would be added to the offset until the max was reached and it reset to 0. So your table might look something like this:

    65, 83, 68, 70
    74, 75, 76, 59

    (following your example, and the table would continue)

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
  • mfavs327mfavs327 Posts: 11
    edited 2007-10-31 13:48
    Thanks for the replys... i will give a couple of those a try
Sign In or Register to comment.