USB HID API Function Library


 
 
 
 
 
  • Description
  • Magazine article
  • Descriptors
  • Screen-shots
  • U4x1 Control
  • Compatibility
  • Buy Now
  • User Manual
  • Contact Us
  •  




    UsbHidApi USB Comm Library

    Low as $39 (standard license)
    Windows DLL for custom applications
    plus demo app w/source code
    also compatible with .NET 2003 & LabView

    Includes demo source code for VC2008, VC6, & VB6




    Description

    Want to develop a USB HID device?  Need Windows PC application software, but don't want to deal with custom device drivers?  Want to develop a quick and easy host PC application to test your USB HID device? The UsbHidApi dynamic link library (DLL) is for you.  Did you know that you don't need a custom driver to access your USB device.  If it's a Human Interface Class (HID) device, you can take advantage of existing Windows drivers.  Used mainly for keyboards, mice, and joysticks, this class is also well-suited for special-purpose applications including access and control of custom-developed devices.  UsbHidApi encapsulates API calls that give you easy access to your device.  These API calls can be used in any development environment that accepts DLLs (e.g., Visual C++ & Visual Basic).  The API has been tested with the following compilers:

    Visual C++ 2008  
    Visual C++ 6.0
    Visual Basic 6.0


    Advertisement:
     
    USB Motion Detector
    For automated kiosks, security, robotics, and more!  Includes Windows software! 

    Click here for details


    Also compatible with LabView and LabWindows/CVI (see note below). 

    Also included is UsbHidApi_NET, a special API version that contains a wrapper for .NET compatibility (see note below).  Compiled using the Visual C++ Toolkit 2003, UsbHidApi_NET is recommended for Visual C++ .NET developers.

    Check out these features:

    Easy to use API calls - Open( ), Read( ), Write( ), etc.
    No custom drivers (uses USB HID drivers already included in Windows)
    Develop PC host applications quickly
    Write applications for USB HID devices
    Two available demonstration applications: Generic and U4x1 (UsbHidApi only)
    Free demo source code included:  Visual C++ 6.0 and Visual Basic
    VC++ 2008 demo source  (generic demo or U4x1 demo)
    VC++ 6.0 demo source (generic demo or U4x1 demo)
    VB demo source (generic demo only)
    Compatible with LabView and LabWindows/CVI (see note)
    Also includes API for Visual C++ .NET developers (see note
    Use implicit- or explicit-linking (DLL required for both options, included)
    Includes dynamic library library (DLL) file






    The UsbHidApi is featured in the February 2010 edition of the Nuts & Volts Magazine, the nation's premier how-to publication.

    The article describes how to use our API to communicate with a PIC Trainer target board.

    Click here to view the article reprint (by permission of T&L Publications, Inc).

    The article was featured as an installment in the "Design Cycle" series by Fred Eady.




    Advertisement:
     
    U4x1 Device Control

    Are you interested in writing a custom application for a UsbMicro U401 or U421 device?   Click here to discover how.


     


    Designing Firmware for Your USB Device?

    One of the key elements in developing firmware for your custom USB device is defining the descriptors.  This is important for proper device enumeration by the host.  There are several types of descriptors including configuration, device, and report.  Many times users will define a valid set of descriptors, but fail to properly classify the device. The device is classified by its "usage" such as a keyboard, joystick, or mouse.  These devices are typically allocated for exclusive use by the operating system.  If you are developing a custom device (e.g., temperature controller, digital input/output board, etc.) using the HID class, your report descriptor should indicate a "Vendor Defined" usage as indicated in the sample report descriptor below (courtesy of L. Zadra):

    /*------ Report Descriptor Group ---------------------*/
    /* This is a basic report descriptor. All data in the */
    /* reports are vendor defined and therefore the host  */
    /* doesn't care  what we transfer                    */

    BYTE code abromReportDescriptor[SIZEOF_REPORT_DESCRIPTOR] =
    {
       0x06, 0xA0, 0xFF, // Usage Page (FFA0H = vendor defined)
       0x09, 0x01, // Usage (vendor defined)
       0xA1, 0x01, // Start Collection (Application)

       // INPUT DEFINITION
       0x09, 0x01, // Usage (vendor defined)
       0x15, 0x00, // Logical Minimum (0)
       0x25, 0xff, // Logical Maximum (255)
       0x75, 0x08, // Report Size ( 8 BITS)
       0x95, EP1_MAX_REPORT_SIZE, // Report Count (16 Bytes)
       0x81, 0x00, // Input (Data, Variable, Absolute)

      // OUTPUT DEFINITION
      0x09, 0x02, // Usage (vendor defined)
      0x75, 0x08, // Report Size (8 BITS)
      0x95, EP0_MAX_REPORT_SIZE, // Report Count (16 Bytes)
      0x91, 0x00, // 0utput (Data, Variable, Absolute)
      0xC0 // End Collection
    };




    You can view the online user manual here:

    View User Manual




    Screenshot - Generic demo app - UsbHidDemo

    (for any USB HID device)


     



    Screenshot - U4x1 demo app - UsbU4x1Demo

    (for USBmicro U401, U421, and U451 devices)


     



    U451 Relay Control

     
    The U4x1 demo app can easily control one or both onboard relays of the USBMicro U451 device.  To do this, follow these instructions:
    • In the "Direction" field, enter "0300".  (This configures PB0 & PB1 signals as outputs and all remaining signals as inputs.)
    • In the "States" field, enter "0300" to turn on both relays.  (To turn on only one relay, enter 0100 or 0200.)
    • To turn off both relays, enter "0000"




    U4x1 Software Development

    The UsbHidApi comm library is compatible with USBMicro U4x1 devices.  Users who want to create their own control software for these devices will find the UsbHidApi library invaluable.  The API may be used with these devices:

    • U401
    • U421
    • U451

    U401 and U421 devices are functionally identical and provide 16 digital I/O signals, configurable in any combination of inputs and outputs.  The U451 is similar in that it provides configurable digital I/O, but also includes two general purpose relays.  (Our U4x1 Demo Application shows you how to control them.)  You can also use U4x1 devices with our USB Digital I/O Commander product. For complete details on U4x1 hardware and interfacing, refer to the USBMicro website

    Control and access of U4x1 device I/O signals involves several steps: 
  • 1) Open the device
  • 2) Configure signals (inputs & outputs)
  • 3) Read/write the device

  • We offer a special U4x1 demonstration option for those interested in developing Windows application software specifically for U401, U421, and/or U451 devices.  Source code (included) demonstrates how to search, open, and initialize the hardware.  Also setup the digital lines for input/output operations.  Even perform SPI master read/write functions.  Includes developed and tested device classes which can be used in your applications.  For purchase information, see details below:




    Compatibility

    UsbHidApi has been tested on Windows platforms including 98, 2000, XP, & Vista and has been used with a variety of HID class devices.  For those with compatibility concerns or unusual interfacing requirements, we offer a 30-day unregistered evaluation.  This limited-use version allows you to test the library with your application on a trial basis.  To request an evaluation, click the link below

    Request 30-Day Evaluation

    Those interested in programming for applications including .NET and LabView should read the following notices: 

     .NET programmers:
     
    Also included is an API version that contains a wrapper for .NET compatibility.  Compiled using the Visual C++ Toolkit 2003UsbHidApi_NET is recommended for Visual C++ .NET developers. 

    Steve Robinson has developed a VB.net (2005) demo using UsbHidApi.  This demo can be downloaded using the link below:

    • Download VB.net demo including source code  (~1Mb)
    Note:  UsbHidApi_NET was compiled and tested exclusively under VC.NET 2003 and is not guaranteed to work with newer .NET compiler editions.

    LabView and LabWindows/CVI programmers:
     
    UsbHidApi may also be used in LabView and LabWindows/CVI applications.  For compatibility with ANSI C compilers, include the following header file in your application: UsbHidApi_2.h.  This is a specially modified version of the original header and is intended for use in ANSI C applications.

    Add the following statement to your C source file:

     #include "UsbHidApi_2.h"

    Add the following library to your list of build objects:

      UsbHidApi.lib

    See the following application notes for additional details:

    FAQ: Using Dynamic Link Libraries with LabWindows/CVI
    Integrating external code using Import Shared Lib. Wizard
    Writing win32 DLLs and Calling them from LabView

    Tony Gray has developed a LabWindows/CVI demo using UsbHidApi.  The demo is available free of charge and can be downloaded using one of the following links:

    • Download full demo including source code  (~15Mb)
    • Download source code files only  (~80Kb)

    Larry Tell has developed a LabWindows/CVI demo using UsbHidApi.  The demo is available free of charge and can be downloaded using one of the following links:

    • Download full demo including source code  (~12Mb)
    • Download source code files only  (~80Kb)



    Get your USB HID product to market quickly with the UsbHidApi library.
     
    *** Important: ***

    Purchased software must be downloaded from this site.  Download instructions will be provided via e-mail within 24 hours after purchase.  Please read our terms and conditions below before purchase.


     
    Buy Now!
     
    Demo Option
    Standard License
    Commercial License*
    Generic:
    (for any USB HID device)
    $39
    $99
    U4x1
    (for USBMicro U4x1 devices)
    $59
    $129



    Terms and Conditions
    Purchased software must be downloaded from this site.  Download instructions will be provided via e-mail. 
    Choose the U4x1 demo option if you are developing specifically for a U401, U421, or U451 device.  Choose the generic demo option otherwise.  Source-code is included with both demos.  Each demo includes projects for Microsoft Visual C++ 2008 and 6.0.  (The Generic demo also includes a Visual Basic project.) 
    Demonstration projects with source code are provided for Visual C++ 2008, Visual C++ 6.0 and Visual Basic 6.0.  Demos are not provided for .NET, LabView, or LabWindows/CVI.
    The Generic demo uses static linking while the U4x1demo uses dynamic linking.  The library file (UsbHidApi.dll) will be automatically copied to your Windows system folder during the install process.
    If you are developing software for resale or distribution, choose the commercial license.  The commercial license allows royalty-free DLL distribution for OEMs and others who wish to use UsbHidApi with their products.
    Sorry, no refunds on purchased software.  If you are not sure the API will work in your application, you are urged to review our compatibility notice.  A special API evaluation version is available for download upon request.

     
    *** Important: ***

    Purchased software must be downloaded from this site.  Download instructions will be provided via e-mail within 24 hours after purchase.  Please read our terms and conditions above before purchase. 


     




    Back to Main Page