Posts

Showing posts from January, 2020

PS/2 Keyboard demo

Image
I've spent some time playing with the STM8 that will interface the PS/2 devices and here is a video of some of the tests working. To get information on the basic system I read  The PS/2 Mouse/Keyboard and The PS/2 Mouse Interface by Adam Chapweske. Which is a very good guide, the only thing that I don't think is born out by my experience is the form of the clock signal. Rather than seeing a transition to low followed by a low plateau, the transition to low is followed by a very quick return to high. This means that a very tight loop is needed to if detection it o be done by polling, so tight that I doubt 2 devices can be handled that way. Instead of this, I'm using an interrupt-driven approach where the drop of the clock line triggers the interrupt, this seem to work reliably and also allows the wait for interrupt (wfi) instruction to be used so reducing power consumption. They keyboard table is now sorted into scan code order to allow a binary chop search to be used.