Pure-hardware PS/2 keyboard interface?

Discussion in 'The Projects Forum' started by autorelease, Apr 9, 2010.

  1. autorelease

    Thread Starter Active Member

    Jan 26, 2009
    I'm building/designing a single-board computer and eventually I'd like to add PS/2 keyboard support. Most projects I've seen involve the microprocessor responding to each clock pulse and doing the serial-to-parallel conversion in software.

    To simplify the software, I'm thinking about building the serial-to-parallel conversion in hardware. Since the PS/2 protocol is 8 data bits, odd parity, 1 stop bit, one idea was to use a UART, like the 6850 ACIA. (Yeah, it's old, but I've already got one, and know where to get more.) It supports externally-synchronized clock signals, so I could connect the PS/2 clock line to the Rx clock input. The 6850 then sets a flag (or triggers an interrupt) when an entire scancode has been received.

    My other thought was to use discrete logic, then I realized it wouldn't work. I can't find a shift register that shifts on the falling edge of the clock, and the chip count would probably get way too high. (You'd need an 11-stage shift register, 3-state buffers, logic to clear the shift register when it's read by the MPU, etc.)

    I'm not concerned about sending data from the host to the keyboard (which requires extra magic). So has anyone used a UART as a keyboard interface?
  2. bertus


    Apr 5, 2008