Aide for mapping
Neurotic_Norman
Posts: 4
Hello everyone!
I'm working on a project converting an electric typewriter to function as a teletype for a Z80 computer. For this I've realized I'll need to map the keyboard, interpret the logic, and program the BSII to interface the "Teletype" with the serial terminal output. I felt it'd be best if I mapped the keyboard first, then the logic. Since I would like to expedite the process of mapping, I wanted to know how I could connect the sixteen leads from the typewriter to the BSII. My thought was depressing a key, and having one pin on the Stamp send out a pulse and having all the other pins look for a response. Each pin will pulse in sequence from 0 to 15. Then it would print which pin was the one connected to the output and which pin received the response. The problem is I don't know how to write the code for this, so I thought I'd ask for a little help.
Thanks bunches!
~James
I'm working on a project converting an electric typewriter to function as a teletype for a Z80 computer. For this I've realized I'll need to map the keyboard, interpret the logic, and program the BSII to interface the "Teletype" with the serial terminal output. I felt it'd be best if I mapped the keyboard first, then the logic. Since I would like to expedite the process of mapping, I wanted to know how I could connect the sixteen leads from the typewriter to the BSII. My thought was depressing a key, and having one pin on the Stamp send out a pulse and having all the other pins look for a response. Each pin will pulse in sequence from 0 to 15. Then it would print which pin was the one connected to the output and which pin received the response. The problem is I don't know how to write the code for this, so I thought I'd ask for a little help.
Thanks bunches!
~James
Comments
It's going to be asked, so I will ask it first.
Is there an output from this device, (ie, Serial Parallel)?
Are there sensors under each key? What typerwriter is it?
There is an input from the computer, which is a serial connection. The keyboard is set up in a matrix, so there are pads under each key but the only outputs are sixteen pins.
The make/model is Brother GX-8250.
If I get into a procrastinating mode (which happens much too often), I may give this a shot.
Have you tested the lines (with a multimeter) to see which pins are connected electrically when the various keys are pressed?
You'll probably need either pull-up or pull-down resistors on the lines being tested. If I may make a suggestion, have your matrix be normally pulled high and have the test line set low by the BS2. The other BS2 pins would then watch for a low pin. I make this suggestion because I think it would be a little easier to wire up a test matrix on the hardware I have handy (the PPDB has 8 active low buttons). It would be easy to switch to an active high rather than active low solution if that would work better for you.
Hey other forum members, it won't hurt my feelings if someone else comes up with some test code first. My PBASIC is pretty rusty.
See: http://www.parallax.com/search?search_api_views_fulltext=nuts+and+volts
Thanks again!
I'd think with 16 pins the BS2 should be able to handle scanning the keyboard without needing shift registers.
I assumed the keyboard is laid out in an 8 x 8 matrix. This really isn't a safe assumption.
I ran into trouble when I wanted to read the input pins in a FOR NEXT loop. I don't know how to make the input pin a variable.
The line:
wouldn't compile.
Is there a way to use the pin number as a variable?
Do I need to use INS and then parse out the bits?
I never spent a lot of time using the BS2 and it has been about five years since I've used it in my own projects.
Thank you.
I added your suggested code and I also decided to test all 15 pins instead of just 8. This way one doesn't need to know how the pins are used in the matrix to test them. I'd think this code should make figuring out the matrix a bit easier.
The code requires each of the 16 pins to be pulled high.
Sorry, but I haven't tested it.
I've attached the code to this post.
So, to-day I went to test out the keyboard interface. I plugged it in, flipped the switch...
and the motor burned out.
So, I have saved the source code to use again when I find a new on which I may apply it.
Sorry all this was rather for naught, but thanks again for all the help.