Chris from Pyroelectro uploaded a new interesting electronic tutorial. In his pages he explains how can someone interface a PS/2 keyboard to a PIC18F microcontroller, with a short theory, a circuit and the complete code for the PIC.
The main goal here is to create a system that is capable of communicating with PS/2 devices, specifically the PS/2 keyboard. The PIC microcontroller will be connected to a PS/2 keyboard and it will receive keypress commands. Whenever a keypress is detected the PIC should output onto a 7-segment LED display which key was pressed.
Since PS/2 is a serial communication protocol and the PS/2 keyboard controls the clock signal we will need to use the PIC's capture module interrupt to detect falling edges (ps/2 data is valid on falling edges). Additionally, some constant values will need to be progammed in to represent letters and numbers to display onto the 7-segment LED output display.