Shop OBEX P1 Docs P2 Docs Learn Events
Keyboard and Mouse - PS/2 emulation — Parallax Forums

Keyboard and Mouse - PS/2 emulation

SkyoneSkyone Posts: 8
edited 2007-07-29 13:53 in Propeller 1
I did my fair share of searching, but all I got was how to take in keyboard input for use with the Propeller.

I'm trying to make a hardware macro circuit using the Propeller and a PS/2 output interface to use with my computer. I've never done much interfacing with PS/2, but I figure that a micro controller would be the best way to do so. Likewise, I've never had any experience with the Propeller! Just various PICs.

I know I'm being vague here, but I don't know what else to say. I want to emulate both keyboard and mouse events through the PS/2 interface using the Propeller. Any idea on how I would go about doing so?

Thanks [noparse]:)[/noparse]
-Skyler

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2007-07-29 04:54
    I believe someone posted code a while ago in a thread. I think they were trying to emulate just a keyboard, but the same thing would hold true for the mouse as well. I hope you have information about the PS/2 protocol. The Wikipedia has some information on it and links to other sites.
  • SkyoneSkyone Posts: 8
    edited 2007-07-29 05:14
    I've been researching about the data transfer protocol between the PS/2 device and the PC, and it seems very basic; just a make/break signal for each event. It's more of the clock/baud that I don't understand.

    Where did you see that thread, Mike? I've been searching up and down!

    -Skyler
  • Mike GreenMike Green Posts: 23,101
    edited 2007-07-29 05:30
    Sorry, I don't remember where the thread was. The PS/2 protocol is clocked (not like asynchronous serial). It's not described as using a Baud. The clock actually comes from the peripheral. In this case, with you emulating a keyboard and mouse, the clock will come from the Propeller and I think there are 11 bits in each data frame. The PS/2 protocol description will give you that information and the range of clock rates allowed.
  • deSilvadeSilva Posts: 2,967
    edited 2007-07-29 05:46
    Skyone said...
    I'm trying to make a hardware macro circuit using the Propeller and a PS/2 output interface to use with my computer. I've never done much interfacing with PS/2, but I figure that a micro controller would be the best way to do so. Likewise, I've never had any experience with the Propeller! Just various PICs.
    I know I'm being vague here,
    You are, indeed. What I understand from your posting is:
    (a) You are developing a complex electronic circuit -> no help needed
    (b) You want to connect it to the Prop -> probably no help needed, as you have general background from PICs.
    (c) you want the Prop to output PS/2 signals to the PC to make it believe you are a keyboard and/or a mouse -> help needed.

    If this is correct, I should recommend:

    (1) Work through the Prop Manual (and the educational examples) to understand its architecture
    (2) Learn SPIN to understand how much assembly language you will need
    (3) Augment your knowledge of Prop assembly language
    (4) Understand the Keyboard Protocol (lots iof excellent information in the web, e.g.
    www.computer-engineering.org/ps2protocol/
    www1.cs.columbia.edu/~sedwards/classes/2005/emsys-summer/ps2-keyboard.9up.pdf
    )
    (5) Work yourself through the mouse.spin and keyboard.spin drivers
    (6) Write your own program

    I think we can help in all 6 steps, when you have a concrete question
  • RinksCustomsRinksCustoms Posts: 531
    edited 2007-07-29 07:43
    I think we'd all agree here that the best path for you Skyone is to work through the Propellers manual and accompanying examples as the way you use this chip as compared to a PIC is very different in thought and program design. We can help but it's a rule we have around here that we will not do your project for you. These forums are most useful when you state a specific problem within a propeller application, post the actual .spin file with your querry.

    Once you are more familiar with spin and (more likely) asembly, you will then be able to write what will likely become a "driver" object where you simply pass it commands based on I/O pin states. Your driver object would then interpet the commands from your I/O reader application and communicate with your PC as if it were a ps/2 keyboard or mouse.

    Quickly looking at the protocol, it specs a simple start/stop/ack sequence, where the host (PC) has total control over the communications, ps/2 device has to generate the CLK signal, and comm speed is between 10-16.7KHz. Your first task - and probably most daunting for your project- would be to create a communication "driver" object to automate communication from your program to the PC, after accomplishing that, inputting events to the prop will be easy, main program will likely be short and straight foward and project dev comes quickly therafter.

    The most important thing to do is to learn the lingo and approach with an open mind, the prop is a pretty powerful and robust little chip. I think the opperating test specs exeed military standards for temperature.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    E3 = Thought

    http://folding.stanford.edu/·- Donating some CPU/GPU downtime just might lead to a cure for cancer! My team stats.
  • SkyoneSkyone Posts: 8
    edited 2007-07-29 13:17
    Thanks a ton for the suggestion, guys! I'll definitely look further into the manuals of the Propeller. Thanks again for clarifying the purpose of these forums. [noparse]:)[/noparse]
  • Graham StablerGraham Stabler Posts: 2,510
    edited 2007-07-29 13:53
    These are useful resources. I wanted to do the same myself so I could use a nice USB keyboard membrane but decided I had better things to do.

    www.computer-engineering.org/ps2keyboard/
    www.computer-engineering.org/ps2protocol/
    www.computer-engineering.org/ps2keyboard/scancodes2.html

    Graham
Sign In or Register to comment.