PS2 Keyboard not funny !!


Closed Thread
Results 1 to 2 of 2
  1. #1
    Join Date
    Jul 2005
    Posts
    18

    Talking PS2 Keyboard not funny !!

    Greetings chaps,

    Yes I have read previous threads on this subject, yes I have tried numerous codes. However, Im really missing something coz the code below only seems to work on laptops. As far as I can see, there aint any difference between PC and laptop PS2. I am using a PIC16F876A @ 20MHZ and 10k pullups connected to SCL SDA lines to PS2. Ultiblade has been kind enough to share his code with me, however, only seems to work on a laptop. Gaaah, this is really bugging me. If anyone can provide some pointers, would be much appreciated.

    Ive tried sending the packet in different ways, as suggested by

    http://www.picbasic.co.uk/forum/show...board+question
    http://www.picbasic.co.uk/forum/showthread.php?t=81

    I have spent waaay too many days on this project without success, now I would really like somebody to give me a bit of a steer. Many thanks in advance.

    Regards

    Juan (what am I doing wrong ??)

    ------------------------------------------------------------


    @ DEVICE HS_OSC,LVP_OFF,BOD_OFF,WDT_OFF 'Sets fuse values on PIC

    INCLUDE "modedefs.bas"
    DEFINE SHIFT_PAUSEUS 50

    DEFINE OSC 20

    ADCON1 = 7
    CMCON = 7


    char var word
    breakcode var word

    clkout1 var portc.3
    dataout1 var portc.4

    a_key con %00001110001 '$1C = 'a'
    h_key con %00011001111 '
    space_key con %00010100101
    esc_key con %00111011001
    F3_key con %00000010001

    redLed var portb.4
    relay1 var portb.5

    breakcode = %01111000011 '$F0



    'a_key con %10001110000 ' $1C = 'a' reverse order
    'breakcode = %11000011110 '$F0 reverse order



    char = a_key
    high relay1
    high redled

    miniLoop:

    high clkout1
    high dataout1


    high redled
    pause 500

    shiftout dataout1,clkout1,4,[char\11]
    pauseus 100
    shiftout dataout1,clkout1,4,[breakcode\11,char\11]
    ' pauseus 100
    ' shiftout dataout1,clkout1,5,[char\11]


    low redled
    pause 500

    goto miniloop

    --------------------------------------------------------------------------------

  2. #2
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    What i'll suggest you
    1. measure your clock frequency and make sure it met the PS2 requirement
    2. record what's happening when you boot your PC and a regular PS2 Keyboard is attached
    3. make sure you timing is right... and... erm... make the sure than PAUSEUS really needed between your data
    4. go back to step 2 and compare a real PS2 data against what you're sending
    5. carefully read the PS2 protocol and see if you're allowed to use SHIFTOUT AS-IS

    It really looks easier than it is actually... trust me...
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

Similar Threads

  1. AT/PS2 Keybord - PIC Interface?
    By Kamikaze47 in forum Code Examples
    Replies: 73
    Last Post: - 9th August 2009, 16:10
  2. One USB keyboard to Two USB Ports
    By picnaut in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 11th June 2009, 00:04
  3. PC Keyboard question
    By HatchetHand in forum mel PIC BASIC Pro
    Replies: 13
    Last Post: - 18th September 2007, 06:03
  4. PS2 keyboard emulator
    By robertg in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 5th July 2007, 20:40
  5. My wish: AT Keyboard and Mouse commands
    By sayzer in forum PBP Wish List
    Replies: 0
    Last Post: - 4th February 2006, 08:23

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts