BS2 sendkeys to computer?
Luis_P
Posts: 246
I really need to know how can I send keystrokes like it was a keyboard doing in it but with the BS2. How can I do that. Any suggestions?
Gracias!
Luis
Gracias!
Luis
Comments
http://forums.parallax.com/showthread.php?t=125339
I guess what you are after is a means of emulating a PS2 keyboard with a Stamp. All 101 keys or just a few? I don't know if you can do all 101, a tall order that, but several might be practicable. You need to decide what you can settle for, find out what those keycodes are, and then hammer it out.
Pretty simple stuff to talk about, right?
I have seen a board or two (who was it?) that can do this.
Why don't/can't you set up your VB situation for communication via a serial port instead trying to come up with a way to emulate a keyboard?
I believe others have done this before, but I don't have any links to their threads. You may just have to browse through the old forums, particularly the Stamp forum and the Completed Projects forum looking for these old threads.
It's synchronous data, so you need DATA and CLOCK outputs from the BS2.
There is a Make (key pressed) scancode and a Break (key released) scancode for each key.
The Make for a is $1C (%00011100), the Break for a is $F0 (%11110000) and then $1C .
The Make for enter is $5A (%01011010), the Break for Enter is $F0 and then $5A.
The synchronous serial transmission is odd parity. The Parity bit for $1C is 0, for $F0 it's 1, and for $5A it's 1.
I'm supposing that there may be an initialization routine.
When I unplug my keyboard and then plug it back in, there is a series of beeps (like post codes) and then it kicks in and it works.
I found a PS2 connector. I'm convinced that I have it set up properly. I wrote a bit-bang routine to knock out a $1C, $F0, $1C, but the PC does some Post-Code beeps and I don't see an 'a' typed in Notepad. So, something is up there.
Yeah...
A little Host:Keyboard conversation may well be required.
http://www.beyondlogic.org/keyboard/keybrd.htm
[You can't Attach as part of "Edit"]
Anyway, here is a pic of my interconnect.
http://forums.parallax.com/showthread.php?goto=newpost&t=125424
Would have never thought the BS2 was fast enough good job!!
I made something about 7 years ago using a PIC that took a serial keyboard (UNIX style) and remapped the output for a PC-Keyboard. This was all in effort to have one keyboard between multiple computers and dual platform computers... Now there is software that will do it if the computers are networked together ... Ho Hum !!
BTW) Yes, there is some post communication that goes on between the Keyboard and PC for it to handshake properly. I have some old notes on this if you would like me to get them. First I had built a line 'sniffer' that could monitor the signals on the keyboard connector and send them serially to a second PC for monitoring.
The program that I wrote is pretty slow.
The AT (PS/2 ?) Clock Idle is HI, it reads DATA on Clock's hi-to-lo transition. SHIFTOUT makes positive-going C-pin transitions. I think I can make that go with an inverter (CE).
I Need a parity parse & calc routine.
Maybe it'll go too fast.
Post Edit -- Let's all chat at the other project from here.
I installed resistors to different switches then the BS2 use RC time to measure resistance, sent values to PC using the serial port then My Visual Basic application read the communication port, receive the data and with some formulas I added to the code, the V.B application knows which switch is closed (according to ressitance value) and then the application use sendkeys to send keystrokes. Is that clear? mmmm
By the way this is for a Fly simulator on my PC.