USB keyboard emulator


Closed Thread
Results 1 to 13 of 13
  1. #1
    Join Date
    Jun 2005
    Posts
    29

    Default USB keyboard emulator

    I'm very close to make it work. I used EasyHID with the Descriptor find in that topic http://www.picbasic.co.uk/forum/showthread.php?t=2872 (curiously this link can only be found by making a search...) I've made some modifications but even with the original file I have the same problem.

    Everything is OK compilation is done without any bug, the enumeration is also perfect (the PC really think a keybord is in). I've put a button and when I press it the letter "a" should be send. When I push the button it works but too much... I have "aaaaaaaaaaaaaaaaaaaaaa....." send endeless. My button works don't be worry I already test it.

    I give the pbp code in attachment but I don't think the problem is inside. I also verified the Descriptor file and it looks like the parameter found in the USB.org files. If you have any idea it will be appreciate cause I think I've tried all but the right thing to do. Thank you very much.
    Attached Files Attached Files

  2. #2
    Join Date
    Mar 2003
    Location
    Commerce Michigan USA
    Posts
    1,166

    Default

    Toley00, Unless you can release the button realy fast, your code as written will re-enter the subroutine while the button is being pressed. At the speed of the osc I am surprised that you arn't getting more "aaaaaa's". You need to check for the button being released and bypass the call if it is, before you check for it being pressed.

    Dave Purola,
    N8NTA

  3. #3
    Join Date
    Jun 2005
    Posts
    29

    Default

    Thank you for your answer Dave but even when the button is release aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa never stop til I reset the PIC or unplug it. The problem is not the button it's sowhere else, is there a kind of break code in USB like in PS/2 keyboard ?

  4. #4
    skimask's Avatar
    skimask Guest

    Default

    You are waiting for the pin to be low. Do you have a pullup on your pin so when it's released the pin has 5v on it?

  5. #5
    Join Date
    Jun 2005
    Posts
    29

    Default

    Finally I found a way. After I send a key code, I clear all the buffer bytes and do another send with all buffers to 0. I'm not sure this is the right way to do it but it work as expected. Naturally I did a little delay (as suggest by Dave) to make sure only 1 code is send. But since it's not the final use of my project the button will disapear. Thanks to everybody here.

  6. #6
    skimask's Avatar
    skimask Guest

    Default

    Is it really that easy to do a USB interface, such as what was done here with the keyboard emulator? PBP 2.46, a PIC w/ USB, and a few simple 'included' files and the required wiring to the connector?

    I've been using the FTDI chips all along and just switched over to the CP2103, but I've been wanting to get rid of the 'middle man' with a USB-PIC.
    I've been wanting to make some custom PCBs and enclosures for simulated aircraft controls (radios, heading bugs, ya know, front panel stuff) like you'd use with FS2K or whatever (Falcon 4, the list goes on).

    Thoughts?

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

    Default

    It's not as this hard, but you may have to learn the PC side too. The hardware is pretty simple.
    Steve

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

  8. #8
    Join Date
    Oct 2009
    Posts
    2

    Default

    I keep getting errors when I try to compile the code generated by EasyHID:

    Error[113] c:\pbp\pbppi18l.lib 723 : Symbol not previously defined (USBDeviceInit)
    Error[113] c:\pbp\pbppi18l.lib 723 : Symbol not previously defined (USBDeviceInit)
    Error[113] c:\pbp\pbppi18l.lib 723 : Symbol not previously defined (USBDeviceTasks)
    Error[113] c:\pbp\pbppi18l.lib 723 : Symbol not previously defined (USBDeviceTasks)
    Error[113] c:\pbp\pbppi18l.lib 723 : Symbol not previously defined (GetUSB)
    Error[113] c:\pbp\pbppi18l.lib 723 : Symbol not previously defined (GetUSB)
    Error[113] c:\pbp\pbppi18l.lib 723 : Symbol not previously defined (PutUSB)
    Error[113] c:\pbp\pbppi18l.lib 723 : Symbol not previously defined (PutUSB)

    I am running PBP 2.60 with MPLabs 8.15a and a PIC18F4550.

    Can anyone help me to figure out what is going on and suggest anything to try to fix this?
    Thanks

  9. #9

    Default easyMSD?

    I'm just starting a project using USB mass storage device types, does anyone know if there are plans for an 'easyMSD', similar to easyHID, or an easy way to use easyHid for my purposes ?

    I want to use internal flash to store files, and am going to use SDFS to handle the FAT file side of things.

  10. #10
    Join Date
    Nov 2007
    Posts
    5

    Default Me too

    pbauman, did you find out what was causing your problem, I have the same problem with the same configuration.

    Thanks,
    RB

  11. #11
    Join Date
    Feb 2011
    Posts
    2

    Default Re: USB keyboard emulator

    Hi Everyone,

    I´m new in this...
    I saw the published file and I have a doubts.. what is the USBService instruction? what it do? how it relates USBproject file with the descriptor file?

    Thanks..!

  12. #12
    Join Date
    Aug 2005
    Posts
    4

    Default Re: USB keyboard emulator

    Quote Originally Posted by pbauman View Post
    I keep getting errors when I try to compile the code generated by EasyHID:

    Error[113] c:\pbp\pbppi18l.lib 723 : Symbol not previously defined (USBDeviceInit)
    Error[113] c:\pbp\pbppi18l.lib 723 : Symbol not previously defined (USBDeviceInit)
    Error[113] c:\pbp\pbppi18l.lib 723 : Symbol not previously defined (USBDeviceTasks)
    Error[113] c:\pbp\pbppi18l.lib 723 : Symbol not previously defined (USBDeviceTasks)
    Error[113] c:\pbp\pbppi18l.lib 723 : Symbol not previously defined (GetUSB)
    Error[113] c:\pbp\pbppi18l.lib 723 : Symbol not previously defined (GetUSB)
    Error[113] c:\pbp\pbppi18l.lib 723 : Symbol not previously defined (PutUSB)
    Error[113] c:\pbp\pbppi18l.lib 723 : Symbol not previously defined (PutUSB)

    I am running PBP 2.60 with MPLabs 8.15a and a PIC18F4550.

    Can anyone help me to figure out what is going on and suggest anything to try to fix this?
    Thanks
    I think this could be the cause of your problems:

    USB_DEV.ASM, USB_DEV.INC, USB_MEM.ASM, the class assembler and include files
    and the project descriptor file, as well as any desired sample programs,
    should be copied to the project source subdirectory before being used.

    (USB.TXT in PBP260\USB18)

    Make sure you copy USB_DEV.ASM, USB_DEV.INC, USB_MEM.ASM into project directory.
    Worked for me.

    All best

  13. #13
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    2,588

    Default Re: USB keyboard emulator

    Jim's posts moved in a new thread:
    http://www.picbasic.co.uk/forum/showthread.php?t=16028

    Robert

Similar Threads

  1. USB CDC Communications for Dummies!
    By Squibcakes in forum USB
    Replies: 104
    Last Post: - 15th January 2014, 14:43
  2. Simple USB Comms Problem
    By awmt102 in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 6th January 2010, 21:17
  3. AT/PS2 Keybord - PIC Interface?
    By Kamikaze47 in forum Code Examples
    Replies: 73
    Last Post: - 9th August 2009, 17:10
  4. One USB keyboard to Two USB Ports
    By picnaut in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 11th June 2009, 01:04
  5. Replies: 3
    Last Post: - 10th April 2008, 11:02

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