Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

PS/2 Keyboard Interface - Make Codes and Break Codes

Status
Not open for further replies.

trix312

Newbie level 6
Joined
Aug 9, 2011
Messages
11
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,378
Hello.
I'm programming a microcontroller so that it can use the PS/2 protocol to communicate with my computer. So far I have managed to program it so that it sends make codes for characters which are then correctly printed on my computer display, it uses the typematic delay and typematic rate and seems to be working fine. I understand that when a key is pressed, its make code is sent and when a key is released a break code is sent (0xF0) followed by the keys make code.
This is the part which does not seem to work. For instance when a key like shift is released all the characters are still being sent in uppercase.

I am sending data one byte at a time in 11 bit frames (inc. start, stop and parity bit). But the host(computer) is not reacting to the break code. How exactly is the break code sent after a key is released. Could anyone provide me with an example.

Thanks.
 

when a key like shift is pressed , it is customary to store the status of shift key separately.
and interpret the following make and break scancode to upper or lower.
shift key is to be treated as a special key. which means you must always interpret the scancodes received based on shift status.
(this is applicable to ctrl and alt also)
 

Hi srizbf, thanks for the reply.

which means you must always interpret the scancodes received based on shift status.
(this is applicable to ctrl and alt also)

If I understand this correctly then you are saying that I must know the status of the shift key in order to control lower and upper case. Where is the shift status stored and how can I control it?
 

that part is on the host computer side which receives the scancodes.
 

So I'm assuming my code is messed up when it comes to receiving data from the host. I tried plugging the microcontroller to another computer and nothing. There is something wrong with the communication.
I took apart an old PS2 keyboard and found the microchip which has the behaviour I'm trying to simulate. It was just a black dot with no names or anything, so that was useless. Then I tried searching for the code that this microchip would have. I assumed that this code is universal and easy to find, given that there have been millions of ps2 keyboards in the past. But I only found long assembly language which confused me further and is not that usefull because I'm writing in C. Is there anyone who could help me find a C written program for the microcontroller that a ps2 keyboard would have? I'm specifally interested in how they receive data from the host and their response.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top