Results 1 to 6 of 6

Thread: PIC talking to PS/2 port?

  1. #1
    Registered DennisCNC's Avatar
    Join Date
    Aug 2005
    Location
    Clearwater, FL US
    Posts
    819
    Downloads
    0
    Uploads
    0

    PIC talking to PS/2 port?

    Any one here worked on projects that involve the pic sending keyboard commands to the computer?

    I would like to see some code if possible

    I want the pic to send numbers to Rhino 3D so I can do some simple 2D digitizing. The numbers will come from rotory encoders with wheels rolling on a X Y plane.

    Thanks
    Dennis


  2. #2
    Registered
    Join Date
    May 2006
    Location
    uk
    Posts
    3
    Downloads
    0
    Uploads
    0
    can you not use the Rs232 interface rather than the AT keyboard. I made benchsaw fence DRO using a couple if pics and the encoders from a mouse had to gear it right down but it worked a treat. there are plenty of microchip programing sites about.


  3. #3
    Gold Member
    Join Date
    May 2005
    Location
    UK
    Posts
    269
    Downloads
    0
    Uploads
    0
    Have a look at http://users.picbasic.org/?page=howtolist there are articles on how to talk to pc keyboards, should give you a good starting point.


  4. #4
    Registered DennisCNC's Avatar
    Join Date
    Aug 2005
    Location
    Clearwater, FL US
    Posts
    819
    Downloads
    0
    Uploads
    0
    Good info!! Thanks, as soon as the big proto board gets here will start experimenting.
    Dennis


  • #5
    Registered
    Join Date
    Jan 2004
    Location
    Thailand
    Posts
    11
    Downloads
    0
    Uploads
    0
    PS/2 Library
    mikroBasic provides a library for communicating with common PS/2 keyboard. The library does not utilize interrupts for data retrieval, and requires oscillator clock to be 6MHz and above.


    Library Example
    This simple example reads values of keys pressed on PS/2 keyboard and sends them via USART.

    program ps2_test
    dim keydata, special, down as byte

    main:
    CMCON = $07 ' Disable analog comparators (comment this for P18)
    INTCON = 0 ' Disable all interrupts
    Ps2_Init(PORTA) ' Init PS/2 Keyboard on PORTA
    Delay_ms(100) ' Wait for keyboard to finish

    do
    if Ps2_Key_Read(keydata, special, down) = 1 then
    if (down = 1) and (keydata = 16) then ' Backspace
    ' ...do something with a backspace...
    else
    if (down = 1) and (keydata = 13) then ' Enter
    Usart_Write(13)
    else
    if (down = 1) and (special = 0) and (keydata <> 1) then
    Usart_Write(keydata)
    end if
    end if
    end if
    end if
    Delay_ms(10) ' debounce
    loop until FALSE
    end.

    http://www.mikroe.com/en/compilers/ http://www.mikroe.com/en/compilers/


  • #6
    Registered
    Join Date
    Jul 2007
    Location
    CHINA
    Posts
    1
    Downloads
    0
    Uploads
    0
    If only send a few keys, you can use a keyborad main board (get from a used keyboard), and connect its circuit with some I/O or some digital chip to do that.

    Sorry for my poor English.


  • Posting Permissions


     


    About CNCzone.com

      We are the largest and most active discussion forum from DIY CNC Machines to the Cad/Cam software to run them. The site is 100% free to join and use, so join today!

    Follow us on

    Facebook Dribbble RSS Feed


    Search Engine Friendly URLs by vBSEO ©2011, Crawlability, Inc.