0
\$\begingroup\$

I have made a CPU on an FPGA board. It works great but I cannot proceed to make a computer with it until I have an input. What use is a computer if it can talk to you, but you cannot talk to it? It runs all on 5V, has essentially a 20 bit address line, is 8-bit, and essentially operates at 12.5MHz. I may speed it up later, so what I am looking for is a maximum of 3 chip solution to give me keyboard input via PS2 or USB. It must give parallel output and operate within 55ns(as I may speed it up). An Atmega is not fast enough.

\$\endgroup\$
  • 5
    \$\begingroup\$ Why can't you have your FPGA talk PS/2? \$\endgroup\$ – Ignacio Vazquez-Abrams Aug 13 '15 at 7:16
  • \$\begingroup\$ I have run out of 5v tolerant GPIO. The processor also already does all the VGA, 256 colors, 256 colmns, and 256 rows. I only have 5v compatible inputs left. thats not enough, right? \$\endgroup\$ – Nuclear_Man_D Aug 13 '15 at 7:44
  • 1
    \$\begingroup\$ If you have plenty of 3.3V compatible inputs, and space in the FPGA, it's probably easiest to level shift them and do PS/2. \$\endgroup\$ – pjc50 Aug 13 '15 at 9:00
1
\$\begingroup\$

The PS/2 keyboard is very easy to interface, and a PC/XT keyboard (with the 5 pin DIN connector) is even easier. For the PC/XT keyboard you just need a 8-bit serial-to-parallel shift register. The keyboard will automatically clock out a 9-bit key scan code for each key press and release; you can connect the keyboard clock signal to the clock in pin of the shift register and data signal to the data in pin of the shift register and you'll conveniently get a 8-bit key code + 1 interrupt bit for each keypress (the 9th bit will be in the shift register's serial out pin and that one you can also use as an interrupt signal if you also clear the shift register after reading each scan code).

For PS/2 keyboard it's similar but there's a few extra bits. Since you are running on the FPGA, it's probably no problem for you to make a 12-bit shift register instead of a 9-bit shift register.

\$\endgroup\$
  • \$\begingroup\$ awesome! I already have a shift register chip. thank you!!! \$\endgroup\$ – Nuclear_Man_D Aug 13 '15 at 9:04
  • \$\begingroup\$ Great. Here's a classic text on the subject: cs.cmu.edu/~jmcm/info/key2.txt \$\endgroup\$ – PkP Aug 13 '15 at 9:34
  • \$\begingroup\$ PS/2 is easy to interface, but I'd imagine its much harder to procure! \$\endgroup\$ – Scott Seidman Aug 13 '15 at 12:28
  • \$\begingroup\$ but now how to get the interrupt? i can do the rest myself. \$\endgroup\$ – Nuclear_Man_D Aug 13 '15 at 18:11
  • \$\begingroup\$ @Nuclear_Man_D, when the start bit shifts to its final position in the shift register, that is your interrupt signal (active low because the start bit is 0). Then you read the data bits from the shift register and finally clear the shift register to all ones. As the next scancode shifts into the register, the ones keep shifting out and only when the next scancode has been received, is that bit zero again. \$\endgroup\$ – PkP Aug 14 '15 at 12:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.