PDA

View Full Version : Keyboard/Mouse question.



RicardoP
09-18-2007, 05:25 AM
Hello!

I've been thinking about this little project and finally I decided to do it. But there are a couple paths that I could take (probably more but anyway ... ) and I would like to get some advice on.

Basically I need keyboard/mouse input, the gotcha is that it needs to be as fast a possible (meaning I don't want much/any delay between the key press and the time the prop does something with it.

Route a)
Use a ps2 hookup directly to the prop, this would probably give fastest response time.

Route b)
Use a pc, read the kb/mouse data and send it to the prop via serial connection.

Route A seems obvious but Route B has a cool advantage ... I can write a nice front end that would allow remapping of the keys (user presses 'W' for example and the program remaps it to some other key)

Thanks!

Spork Frog
09-18-2007, 05:31 AM
Obviously the former will be faster. Of course, as well, you can re-map the keys within your program. No one says that "W" actually has to show "W" in the end. Of course, that could mean somewhat large tables of re-mapping. Although, in the end re-mapping on the prop directly would still be easier (I'd think) than trying to do it with a PC. Then it's self-contained as well.

RicardoP
09-18-2007, 05:36 AM
Could serial communications be done fast enough that the delay wouldn't be something a human would notice?

Graham Stabler
09-18-2007, 06:19 AM
There is no noticable lag when using the keyboard object.

Graham

hippy
09-18-2007, 06:52 AM
It seems overkill to add a PC to do a job the Propeller can. A keyboard lookup table should not be overly large, and it would run far quicker than a PC application routing via serial.

If you wanted / needed to off-load work from a Propeller, you could always use another Propeller instead of a PC. Far cheaper, more 'planet friendly'.


RicardoP said...
Could serial communications be done fast enough that the delay wouldn't be something a human would notice?


In tests I once did, few perceived a delay between pushing a button and a LED coming on 100mS later. It takes around 20mS for a character received to be shown on a monitor. Serial comms would run far faster than that, so the answer is the delay would not be noticeable.

Post Edited (hippy) : 9/17/2007 11:59:50 PM GMT

Ariba
09-18-2007, 08:01 AM
RicardoP said...

Route b)
Use a pc, read the kb/mouse data and send it to the prop via serial connection.



This is exactly was PropTerminal does. Try it out to decide if this way is fast enough for you:
http://forums.parallax.com/showthread.php?p=649540

Andy

Mark Bramwell
09-18-2007, 08:50 AM
You could also look at Color-Code.spin that I posted yesterday. You use your PC with hyperterminal at 9600 baud. The I,J,K,M keys each cause the propeller to perform a function on the screen. Is there a delay?

There 2 versions of the program in the zip file. One uses a PS2 keyboard plugged into the protoboard, the other is serial. I believe those 2 programs should be able to answer your questions.

RicardoP
09-18-2007, 09:42 AM
Thanks all for your replies. I will try all the suggestions and see what works best.