USB HID Controller

Discussion in 'The Projects Forum' started by james2k2, Sep 6, 2009.

  1. james2k2

    Thread Starter New Member

    Sep 6, 2009
    Hi all,
    I've already got some Microchip PIC's (18F1320 & 16F88) and am looking to build a USB HID controller with say 12 buttons. I'm pretty certain the 16F88 doesn't support hardware USB, but i'm unsure about the 18F1320 chip, however - i have seen that it may be possible to program a software implementation for USB and then some scanning code for a button matrix to allow for the large number of inputs.

    I have already tried a google search for this kind of thing, but all i can find are solutions using the ATmega8, but i don't want to really spend much more when i already have these Microchips. If you could provide any direction for this kind of project, then i would be very grateful.

    Kind regards,
  2. blueroomelectronics

    AAC Fanatic!

    Jul 22, 2007
    The 18F2550 has hardware USB.
  3. GetDeviceInfo

    AAC Fanatic!

    Jun 7, 2009
    No, it is not possible. Some will say that anything is possible, but in a practical sense, it's not.
    A MAX3421 is a combo host/device controller on SPI.
  4. n9352527

    AAC Fanatic!

    Oct 14, 2005
    Here's a list of PICs that support USB

    It is possible for a PIC to bit-bang a USB device implementation of low-speed device. But it has to run at high frequency to do so. 1.5Mb/s data rate, multiply by 4 for fosc/4, and multiply by another factor of ~4, because PIC needs several instruction to decide the value and toggle a pin. So, maybe it is possible with a PIC running at more than ~24MHZ. That means 18F running with crystal or new XLP 16F1936/7 running on 32MHZ internal osc.

    There is just no sense in developing a firmware only USB device implementation, when the cost of high frequency PIC is in parity with the USB equipped PIC (18F13K50 is cheap).

    For AVR, it is different. Because the fosc is not divided by four, it is possible to use low-cost, low-end AVR (even an 8-pin ATtiny!) that runs with internal oscillator at 16MHZ to bit-bang a USB device implementation.

    Because you need more pins to interface the buttons anyway, there is just no cost or size benefit of using firmware only USB.
  5. jj_alukkas

    Distinguished Member

    Jan 8, 2009
    Most 18F's have hardware USB and you can build a controller

    For buttons you can use PIC PS/2 drivers and have as many keys as a keyboard does by just using its chip with the PIC's 2 ports.

    Another way is to use a resistor ladder with the PIC's A-D converter but that cannot be used here as only one button can be pressed at a time. It finds applications in number locks.
  6. james2k2

    Thread Starter New Member

    Sep 6, 2009
    Many thanks for all your responses, especially as this is my first (well, now second) post. I can basically see that I would need a different PIC to ultimately do what i want to do. After some deeper searching, i came across a post similar to mine and the general consesnsus was it would/could be cheaper and more practical (effort wise) to hack up a USB joypad/stick. The reason for this project is for my Arcade Controller which i have built and it already has a method of interface. It currently uses a PS/2 port and although this works it is not ideal unless i were to buy a USB keyboard, which i suppose may also be a nice idea. The other reason for this project was to build a 12 button interface for an in-car computer system, but again - it may be more suitable to hack up a cheap £15/$18 USB number pad.

    Sorry for the banter,