USB Keyboard input don't work!!! Please Help


+ Reply to Thread
Results 1 to 18 of 18
  1. #1
    Join Date
    Jan 2008
    Posts
    13

    Lightbulb USB Keyboard input don't work!!! Please Help

    I send the charters to computer but how to recieve from computer aplication command turn the CAPS LOCK on or off.
    It's possible that i don't have good KBDdesc.asm?
    Please, please, HELP. I't urgent! I have good chance to get new job with this project!
    Thank you!!!

  2. #2
    skimask's Avatar
    skimask Guest

    Default

    Quote Originally Posted by faaktoo View Post
    Please, please, HELP. I't urgent! I have good chance to get new job with this project!
    Thank you!!!
    Then, just think, if somebody helps you figure out this 'project', and you get that new job, what happens when the next project comes down and you don't have the answer right away? You get to find another new job!!!

  3. #3
    Join Date
    Oct 2003
    Location
    Australia
    Posts
    257

    Default

    Hey I know that job and I'm applying for it too. And guess what, I have the caps lock working!!!! I think they're going to give me the job now so you might as well give up.

    Hahaha!

    Squib

  4. #4
    skimask's Avatar
    skimask Guest

    Default

    Quote Originally Posted by Squibcakes View Post
    Hahaha!
    Squib
    Nope...you won't.
    You didn't say the magic words...
    Please Please Help Help Urgent! Plz! Danger Will Robinson! Danger!

  5. #5
    Join Date
    Jan 2008
    Posts
    13

    Default You are very clever, ha ha!

    I'm not born with intelect. We all need to learn to bee smart.
    I think that forum member it here to help me and others to become a beter in programing PIC. Ok, i don't need this job, i'm stupid, i give up.
    If you still want to help, thank you.

    Best regards.

  6. #6
    Join Date
    Jan 2006
    Location
    Toronto
    Posts
    109

    Default

    You haven't even posted your code so how can we help you?

  7. #7
    Join Date
    Jan 2008
    Posts
    13

    Default Ok

    This is code for keyboard emulation(some keys) and kbddecs. It's work fine(sending ).
    Attached Files Attached Files
    Last edited by faaktoo; - 5th June 2008 at 16:10. Reason: I forgat files

  8. #8
    skimask's Avatar
    skimask Guest

    Default

    Quote Originally Posted by faaktoo View Post
    This is code for keyboard emulation(some keys) and kbddecs. It's work fine(sending ).
    Where's the part that receive the commands for the LEDs on the keyboard?

  9. #9
    Join Date
    Jan 2008
    Posts
    13

    Default Somthing like this?

    Dousbin:
    USBBufferCount = USBBufferSizeRX ' RX buffer size
    USBService ' keep connection alive
    USBIn 1, USBBuffer, USBBufferCount, Dousbin ' read data, if available

    If USBBuffer[?] = ? then
    PORTA = %00000001
    else
    PORTA = %00000000
    endif
    return
    I'm tried If USBBuffer > 0 then


    PS
    Are "KBDDESCMOJA" OK?

  10. #10
    Join Date
    Jan 2008
    Posts
    13

    Default Somthing like this?

    Dousbin:
    USBBufferCount = USBBufferSizeRX ' RX buffer size
    USBService ' keep connection alive
    USBIn 1, USBBuffer, USBBufferCount, Dousbin ' read data, if available

    If USBBuffer[?] = ? then
    PORTA = %00000010
    else
    PORTA = %00000000
    endif
    return

    I'm tried
    If USBBuffer > 0 then 'If recieve anything
    PORTA = %00000010
    endif
    but nothing hepend

    My friend it programing on VB6 and he give me a small prog for sending commands for LED's(ON-OFF).


    PS
    Are "KBDDESCMOJA" OK?

  11. #11

    Default

    If you looked in the other thread you would see the answer. You need to read the USB HID Class Device Description document from usb.org. In this document it tells you the exact format of the packet that the computer sends that has the status of the CAP Lock and other signals. You need to process this OUT packet.
    Tim Barr

  12. #12
    Join Date
    Jan 2008
    Posts
    13

    Default I dont understand

    How many bytes USB keyboard receives? When? Where is LED's data stored?
    Attached Images Attached Images  

  13. #13
    Join Date
    Oct 2003
    Location
    Australia
    Posts
    257

    Cool

    Ok Faaktoo


    Firstly the caps, numlock status are sent as bits in byte zero sent from the pc. These are are always sent from the pc on every DoUSBin service.

    Code:
    ' BYTE 0 - LEDS STATUS (USBIN, OUTPUT REPORT)
            'BIT 0 = NUM LOCK
            'BIT 1 = CAPS LOCK
            'BIT 2 = SCROLL LOCK
            'BIT 3 = COMPOSE      
            'BIT 4 = KANA
            
            'BIT <5:7> = NOT USED PADDED DATA
    If you want to display the status of the caps, num lock, scroll lock on your pic than you could put some LEDs on a port and assign var to them , example:

    Code:
        ' the leds
        NUM                 VAR PORTB.0
        CAPS                VAR PORTB.1
        SCRL                VAR PORTB.2
    If this bit is 1, the led is on. If it is 0, the led is off.

    Than in your main program your can display the satus of the scroll lock etc in a DoUSBin routine.

    Example

    Code:
    ' ------------------------------------------------------------------------------     
       
    DoUSBIn:
    '   =======================================
    '   Check and receive data from the USB bus                            
    '   =======================================
    
        USBBufferCount = USBBufferSizeRX                ' RX buffer size
        USBService                                      ' keep connection alive
        USBIn 1, USBBufferin, USBBufferCount, SHOWLEDS
    
    SHOWLEDS:
        
        NUM  = USBBufferin.0(0)    ' num lock
        CAPS = USBBufferin.0(1)    ' Caps lock
        SCRL = USBBufferin.0(2)    ' Scoll lock
        
        return
    To display the status of the Caps lock, Num lock etc on the keyboard (ie simulate the key press on a button connected to your pic) just send the key number for the caps, num lock etc as part of your DoUSBout Bytes.

    For caps lock it is $39
    For scroll Lock it is $47
    For num lock it is $53.

    BTW, You still haven't said please yet.
    Last edited by Squibcakes; - 13th June 2008 at 02:35.

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

    Default

    Why is this so hard to
    find,
    download
    and use a USB sniffer as suggested many time here?

    HHDSoft USB Monitor is one of the thousand one available.

    BTW, You still haven't said please yet.


    Who's your daddy huh?
    Steve

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

  15. #15
    skimask's Avatar
    skimask Guest

    Talking

    Quote Originally Posted by Squibcakes View Post
    For caps lock it is $39
    For scroll Lock it is $47
    For num lock it is $53.
    BTW, You still haven't said please yet.
    $139 for the code? Wow!

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

    Default

    All this time i thought i would make $D3
    Steve

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

  17. #17
    Join Date
    Oct 2003
    Location
    Australia
    Posts
    257

    Thumbs up

    Hahaha.

    Very funny guys.

    Have a great weekend!

  18. #18
    Join Date
    Jan 2008
    Posts
    13

    Default Hello dear members!!!

    I find the where is my firs problem. In KBDDESC.ASM. This file is designed one way only. I put one more endpoint and my DOUSBIN it start to work (finaly).

    I'm sory for my English and thank you very mutch for the help.

    Ha, I did it. I'm the men for the new job

Similar Threads

  1. Simple USB Comms Problem
    By awmt102 in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 6th January 2010, 21:17
  2. AT/PS2 Keybord - PIC Interface?
    By Kamikaze47 in forum Code Examples
    Replies: 73
    Last Post: - 9th August 2009, 17:10
  3. One USB keyboard to Two USB Ports
    By picnaut in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 11th June 2009, 01:04
  4. Replies: 3
    Last Post: - 10th April 2008, 11:02
  5. PICBasic newbie problem
    By ELCouz in forum mel PIC BASIC Pro
    Replies: 32
    Last Post: - 12th February 2008, 01:55

Posting Permissions

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