PS/2 Keyboard demo

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. This limits the iteration to a maximum of 6, previously the mean was 32 with a maximum of 64. If new keys are added then they table must be restored. The code to do this is in the source commented out and needs to be moved to a desktop developer to run.
The UART is running at over 400k baud which seems reliable there is a 32-byte buffer on the UART, which is also interrupt-driven. I've left the polling method in but is not complied because of a define.




Comments

Popular posts from this blog

Slow Slow Slow

Interrupted

CPLDs & Xilinx