Tag archives for USB HID

USB Communication with PIC Microcontroller

Many computers especially portable ones do not have a serial port (COM Port) anymore. When a connection to a Personal Computer (PC) is required, a USB is the choice. The Universal Serial Bus (USB) is the widely used interface in electronic consumer products today. Most of electronic devices have at least one USB port on them, this include PCs, cameras, GPS devices, printers and so on. Some PIC18 microcontrollers support USB interface directly. 16bits (PIC24) and 32-bits (PIC32) pic microcontrollers have also an embedded USB interface. In this article we will learn how a communication between a host PC and a microcontroller can be achieved with a USB bus.

USB Human Interface Device Communication with PIC Microcontroller – MikroC

The HID device class code is "0x03, this class is used for devices operated by human, devices like keyboard, mouse, joystick and so forth. The advantage of HID devices is that, they don't require to install drivers, in most modern operating systems, the device will be detected without any problem. The USB HID protocol allows a personal computer to recognize a USB HID connected to it without the need to create a device driver, this is the same like when you connect a USB optical mouse or a USB keyboard you don't need to install drivers for that. Windows operating system will load the required drivers, all that is needed is to to supply the PC with a descriptor file containing some information from the device like Vendor ID (VID), Product ID (PID), Manufacture name and so forth. MikroC Pro for PIC provides USB HID library that make it easy for a host device to communicate with a slave device on a USB bus.

Microchip Libraries for Applications

Microchip Libraries for Applications (MLA) is a collection of Microchip firmware libraries, drivers, demo projects, documentation and utilities for different type of applications including USB, Graphic displays, File I/O (Memory cards), TCP IP, Smartphone and many more. Not all firmware libraries and demo projects from Microchip are distributed in this package; rather, this package includes a few specific libraries that tend to be used together. By distributing libraries that are used often together, Microchip can provide example projects that integrate the use of multiple libraries.