pic as ps/2 keyboard


Closed Thread
Results 1 to 26 of 26

Hybrid View

  1. #1
    Join Date
    Jan 2005
    Posts
    72


    Did you find this post helpful? Yes | No

    Default

    thank you ralph for the reply

    what i'm not sure :
    - i need no external hardware, or?
    - i can realise the software with shiftout?

  2. #2
    Join Date
    Feb 2004
    Location
    Germany
    Posts
    762


    Did you find this post helpful? Yes | No

    Default

    mischl,

    this is probably the link you are after
    regards

    Ralph

    _______________________________________________
    There are only 10 types of people:
    Those who understand binary, and those who don't ...
    _______________________________________________



  3. #3
    Join Date
    Jan 2005
    Posts
    72


    Did you find this post helpful? Yes | No

    Default

    ralph, thanks for the help.

    i've looked for many sites and found asm as well bs examples. i read a lot about protocols and test my own code. because i have several problems and i'm a bit confused my question : has anybody else a piece of code which send at-keyboard commands to pc host?

    if it is only a piece to test, it would me helps a lot

    thanks for a support

  4. #4
    Join Date
    Nov 2004
    Posts
    61


    Did you find this post helpful? Yes | No

    Default Ps/2

    I had a PS/2 KB emulator running a few weeks ago. I don't have the code right in front of me, but I wrote it all in PBP.

    You can use the SHIFTOUT command with no problems - just tell shiftout to only send 9 bits instead of 16.

    Don't forget to calculate the parity bit (odd) and tack it on at the end.

    Clock and data both idle high, so make sure you use pullup resistors.

    I'll dig around and see if I can find the code later this afternoon.

    John

  5. #5
    Join Date
    Nov 2004
    Posts
    61


    Did you find this post helpful? Yes | No

    Default Found it!

    Here's a code snippet to transmit PS/2 data:

    In this case, dataout is an array of bytes I may want to send to the computer.

    Odd parity is NOT the value of all bits XOR'ed together.

    Good luck!

    John


    * * *
    for x = 0 to 7
    if dataout[x] <> 0 then
    sendthis = dataout[x]
    parity = not(sendthis.0 ^^ sendthis.1 ^^ sendthis.2 ^^ sendthis.3 ^^ sendthis.4 ^^ sendthis.5 ^^ sendthis.6 ^^ sendthis.7)
    sendthis = sendthis << 1 'move over to insert start bit
    sendthis.0 = 0 'start bit
    sendthis.9 = parity
    sendthis.10 = 1 'stop bit
    shiftout kbddata,kbdclk,4,[sendthis\11]
    dataout[x] = 0
    endif
    next x

  6. #6
    Join Date
    Jan 2005
    Posts
    72


    Did you find this post helpful? Yes | No

    Default

    hello john

    thanks for your support.

    i work with a similar code. so i have some additional questions :

    - which osc speed do you use? - i have a 16f876 with 4M
    - have you defined a shift_pauseus? - i try it . around 40us seems best
    - how long do you wait until you send the release code (F0) after the button press comand? - i don't wait
    - how looks your hardware setup? - 2 transistors at portc with pull up works at best. nod good because i get different chars... when i only take pullups instead the transisitors, after connect the keyboard it wouldn't be initialized.
    - what are you doing at the booting from the pc?

    best regards

  7. #7
    Join Date
    Nov 2004
    Posts
    61


    Did you find this post helpful? Yes | No

    Default

    - which osc speed do you use? - i have a 16f876 with 4M

    '628 @ 20 MHz

    - have you defined a shift_pauseus? - i try it . around 40us seems best

    I used 50 uS

    - how long do you wait until you send the release code (F0) after the button press comand? - i don't wait

    In my particular application, I sent a 'make' code at keydown and a 'break' code at keyup. So the waiting time was up to the buttonpusher.

    - how looks your hardware setup? - 2 transistors at portc with pull up works at best. nod good because i get different chars... when i only take pullups instead the transisitors, after connect the keyboard it wouldn't be initialized.

    Just a pair of 4K7 pullup resistors on clock and data. The pins on my pic are set to be inputs (high impedence) unless I'm transmitting.

    - what are you doing at the booting from the pc?

    My project doesn't so far parse all of the boot communication which takes place, because it's only used after Windows has totally started.

    I'd started to send copies of the incoming data out to a terminal program so I could see what was being said, but didn't spend much time there due to other projects.

    However, one of the documents mentioned earlier in this thread has a fairly detailed description of the commands and responses that will be flying around on a properly configured system.

    Sorry I can't help much more.

    John

Similar Threads

  1. PS/2 keyboard emulation
    By CumQuaT in forum mel PIC BASIC Pro
    Replies: 8
    Last Post: - 25th September 2009, 04:32
  2. I've made keyboard with pic, but i have a problem.
    By XErTuX in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 8th November 2008, 00:40
  3. Pic to PC AT keyboard caracters
    By sezgin05 in forum General
    Replies: 5
    Last Post: - 27th March 2007, 10:45
  4. PS/2 mouse and keyboard
    By DanPBP in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 17th September 2006, 16:29
  5. Serial Pic to Pic using HSER
    By Chadhammer in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 11th March 2005, 23:14

Members who have read this thread : 0

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