+ Post New Thread
Results 1 to 5 of 5
  1. #1
    Newbie level 6
    Points: 360, Level: 4

    Join Date
    Aug 2011
    Posts
    11
    Helped
    0 / 0
    Points
    360
    Level
    4

    PS/2 Keyboard Interface - Make Codes and Break Codes

    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.

    •   Alt9th August 2011, 17:43

      advertising

        
       

  2. #2
    Advanced Member level 4
    Points: 7,982, Level: 21

    Join Date
    Apr 2010
    Posts
    1,207
    Helped
    242 / 242
    Points
    7,982
    Level
    21

    Re: PS/2 Keyboard Interface - Make Codes and Break Codes

    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)



    •   Alt9th August 2011, 18:20

      advertising

        
       

  3. #3
    Newbie level 6
    Points: 360, Level: 4

    Join Date
    Aug 2011
    Posts
    11
    Helped
    0 / 0
    Points
    360
    Level
    4

    Re: PS/2 Keyboard Interface - Make Codes and Break Codes

    Hi srizbf, thanks for the reply.

    Quote Originally Posted by srizbf View Post
    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?



    •   Alt9th August 2011, 19:09

      advertising

        
       

  4. #4
    Advanced Member level 4
    Points: 7,982, Level: 21

    Join Date
    Apr 2010
    Posts
    1,207
    Helped
    242 / 242
    Points
    7,982
    Level
    21

    Re: PS/2 Keyboard Interface - Make Codes and Break Codes

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



  5. #5
    Newbie level 6
    Points: 360, Level: 4

    Join Date
    Aug 2011
    Posts
    11
    Helped
    0 / 0
    Points
    360
    Level
    4

    Re: PS/2 Keyboard Interface - Make Codes and Break Codes

    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.



+ Post New Thread
Please login