Hey sorry about the delay in my reply!
Right the parity bit is used in error detection (NOT CORRECTION). The idea is that if in the 8 bits representing the scan code, there was only say 5 logic 1's (high) then the parity bit would be logic 1.
this is the type of parity used by the keyboard protocol. The idea is too keep an even number of 1 bits, this is even parity. Be careful, this is only one naming convention, there is another where the opersite name is used, in this convention the last example would be odd parity, u have to love the person that made up these names.!
A problem u will find with ur project is that the keyboard has to respond to the host a lot see
**broken link removed** for specifics, now these commands allow for say the status LEDs to be updated. Handeling these is a pain. There are 2 ways i would go about dealing with this.
A.
Make a device that goes inbetween, and is rather passive but would only use 3 pins on the PIC. The data line is hooked up to a pin, and there is a clock to the comp, and clock to the keyboard pin.
There would be 3 "modes" for the PIC, mode one, copy all of the computers clock signals to the keyboard, mode two, the keyboard is sending data to the computer, the pic outputs the keyboard clock to the computer. mode three, intercept mode, the keyboard clock line is driven low, this forces the keyboard to buffer any keypresses, allowing you to send ur JoyPad's data to the computer.
The problem with this method is it requires a fast PIC to update the opersite clock line in mode one and two. However a 20Mhz clock would be able (remeber that it will only cycle at 5Mhz thou!!)
a simple block diagram would look like this (my ASCII art is poor btw)
Code:
Gamepad
|
+------------+ +----------+ +--------------+
| keyboard! | | PIC | | Comp |
| clk |--------------| |---------------| clk |
| data |---------+ +----------+ +---------| data |
+------------+ | | | +--------------+
+---------+-----------+
B.
The PIC completely emulates a keyboard, this is harder to program, but all the information you need has been loveingly put together by Adam Chapweske on that link i gave you above. The PIC also emulates the Computer, there is actually little advantage in this method, in my opion any way, but i have seen it done before. This would be particually good if u wanted to say make a keyboard switch/emulator at the same time, to let u share 1 keyboard with 3 machines. The key thing is that the data line is broken into 2. This would probably be safer if the keyboard desided to ignore your request and write to the data, this way no harm would be done.
I can't think of an advantage for this project, and have forgotten the reason i mentioed it :? !
anyway a block diagram would like like this (ish)
Code:
+------------+ +-------------+ +----------+
| Keyboard | | PIC | | Comp |
| clk |-----------|kclk cclk|----------| clk |
| data |-----------|kdata cdata|----------| data |
+------------+ +-------------+ +----------+
Hope that helps you with ur desing problems, if u send me a mail at alex at -dont-spam-me-darn-spam-harvesters- 0bytes.net and i will dig out some of the keyloger code that might be helpful.
Also, please let us all know how ur project goes!