View previous topic :: View next topic |
Author |
Message |
water_river
Joined: 17 Feb 2004 Posts: 16
|
Some PS2 keyboard interfacing problems |
Posted: Wed Mar 03, 2004 4:19 am |
|
|
hi,all
I am doing a PS2 keyboard interfacing project with the microcontroller but meet some strange problems:
1. It usually sends out two or three bytes when a key is pressed, but none of them is the value in the keyboard translation table.
2. When connecting the keyboard to a pc at the same time, the bytes sent out are different from those without connection to pc. And they are always changing. However, the pc can get the input without any error.
3. The clock input ususally seems causing 12 cycles when a byte is being sent, but according to the sources online it should be 11 cycles.
Could anyone give some thoughts on those problems to me ??
I am also wondering whether we need to do some initializations to the keyboard. Do anyone have any ideas about that??
Thanks in advance |
|
|
Hans Guest
|
|
|
Ttelmah Guest
|
|
Posted: Wed Mar 03, 2004 6:06 am |
|
|
Seperately, the 'codes' involved, are not the key numbers expected. The codes returned, are the keyboard 'scan code' (which is distinct from the keyboard number).
If you look at:
<http://www.opencores.org/cvsweb.shtml/ps2/misc/scancode_translation_values>
The code for this contains the translation table for these values.
Best Wishes |
|
|
JimFranklin
Joined: 03 Mar 2004 Posts: 2 Location: Warrington, England
|
|
Posted: Wed Mar 03, 2004 6:48 pm |
|
|
Quote: | I am doing a PS2 keyboard interfacing project with the microcontroller but meet some strange problems: |
Me too, I grabbed the PS/2 connector diagram from the 'net, wired it to the pic and smoked the keyboard....
ah, when they connector as viewed from "pin end" they didn't actually mean the "pin end", they meant the wire end.. :(
Jim.
[currently working on keyboard No. 2] _________________ The good thing about being mad, is that you always have someone to talk to, even if it is yourself. |
|
|
water_river
Joined: 17 Feb 2004 Posts: 16
|
|
Posted: Thu Mar 04, 2004 1:16 am |
|
|
hi,all,
Thank you ver much. I found that some clock cycles were missed as too many things were done inside the interrupt function. Now I can get the data correctly. But when I try using another keyboard, which is relatively new, the bytes gotten seem different, for example, "1c" becomes "8c". I can still get the break code "F0". Does anyone know why?? |
|
|
|