USB (Part 1) - Introduction
What is USB?
USB stands for Universal Serial Bus and has replaced on may computer the standard (RS232) serial interface.
It is the most popular connection used to connect a computer to devices such as digital cameras, printers, scanners, and external hard drives. USB is a cross-platform technology that is supported by most of the major operating systems. On Windows, it can be used with Windows 98 and higher. USB is a hot-swappable technology, meaning that USB devices can be added and removed without having to restart the computer. USB is also “plug and play”. When you connect a USB device to your PC, your operating sytem should detect the device and even install the drivers needed to use it..
There are various versions of USB. The original version of USB is USB 1.0, supporting speeds of up to 11 Mbps and was used mostly to connect keyboards and mice. This is also the version that is supported by the JAL USB driver although the PIC USB hardware is able to support USB 2.0 which supports speeds up to 480 Mbps. If you want to know more about the higher USB version you can find all information on the Internet..
How does USB work?
That is a little bit complex to explain. If you want to know more about this, visit the official USB website where you can find all specifications of the Universal Serial Bus. You can also find websites which explain this very well like USB in a nutshell .
What you should know is that it uses 4 connections of which two are for power and the other two, called Data+ and Data-, are for communication. There are different types of connectors as shown in the following picture.
The Jallib USB library
Of course you can only use the Jallib USB library with PICs that have the USB hardware on board. This hardware is called the USB Serial Interface Engine (SIE). This SIE only supports the PIC to be a USB device, which means that it always needs a USB host like your computer. The host configures the PIC and initiates all USB transmissions.
- Using the PIC as a serial (COM) port
- Using the PIC as a keyboard
- Using the PIC as a mouse
- Using the PIC as a Human Interface Device (HID)
To show you how this works, we need some hardware and software. The hardware used for this Tutorial consists of a PIC16F1455 with some LEDs that can be controlled via USB. The schematic diagram of this hardware is given below.
In the next section we will create a program that makes it possible to control the LEDs on a PIC from a (host) computer using the USB as serial port. For the serial interface from the computer to the PIC, a free terminal emulation program Termite is used, but any other terminal emulation program will do.