1. This forum section is a read-only archive which contains old newsgroup posts. If you wish to post a query, please do so in one of our main forum sections (here). This way you will get a faster, better response from the members on Motherboard Point.

PS2 keyboard emulation

Discussion in 'Embedded' started by Meindert Sprang, Jul 2, 2003.

  1. Hi all,

    I am trying to generate PS key scancodes with a microcontroller in order to
    send a key press and release to a PC. I can find all sorts of documentation
    on the web to attach a keyboard to a controller, but I want to do the
    opposite: drive the PC from a controller. I wrote some code that generates
    the proper scan codes and verified it against a real keyboard. All data is
    the same. However, the PC does not see the scan codes. I noted that the PC
    can also send codes to the keyboard. I wonder if this is causing the
    problem: my controller does not do reception of scancodes, so I can imagine
    that the PC thinks no keyboard is attached because it does not respond.

    So the big question is: does a keyboard controller *have* to respond to
    commands from the PC?

    Meindert Sprang, Jul 2, 2003
    1. Advertisements

  2. Ha, I found out that I mirrored the pinout of my PS2 connecter. I even
    implemented a wait loop until both CLK and DATA are high, before starting
    transmission. I managed to get the computer to read a key make but it did
    not see the release scancode. So, still not working ok.

    Meindert Sprang, Jul 2, 2003
    1. Advertisements

  3. Meindert Sprang

    Juan Lauda Guest

    Maybe your PC sends a RESET command to the "keyboard" on startup and expects
    an ACK in response? If it doesn't get an ACK then the PC might choose to
    ignore the keyboard from this point on. If your controller does not receive
    commands from the PC then it will be difficult to send the ACK in a timely
    Juan Lauda, Jul 2, 2003
  4. Meindert Sprang

    Rob D. Guest

    Hi, all,

    Check out the book and source code in Gary Konzak's book PC Keyboard Design.
    It is available at Annabooks. Additional free info available from USAR
    KeyCoder data sheets etc.

    Rob D., Jul 2, 2003
  5. i'm not sure this has the information you're looking for, but it seems
    like a pretty good resource.

    Adam Chapweske's PS/2 protocol/interface pages:

    Wile E. Coyote, Mar 7, 2005
  6. Meindert Sprang


    Aug 18, 2010
    Likes Received:
    Lucky here, Im a new bie in this field, i am trying to do the same task, please can you share me the code.Please help me in learning. Thanks in advance.
    lucky5, Aug 18, 2010
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.