USB Design By Example: Examples

USB Design By Example

Design Examples








The many examples in the book are listed here for your convenience. They are listed by Chapter and Name.

There may have been corrections to this software since this CDROM was manufactured. Please check on my
website for updated software.
If you find errors in any of the software please send me an email and I will post all corrections on my website.

Which example are you interested in?
Return to Main Menu

Overview of the Examples
There are two parts to most of the examples (Chapter 4 examples are PC Host only): PC Host - this is the Visual Basic program the runs on the PC, and, IO Device - this is the program that runs on the USB microcontroller. The source code for all of the examples is provided in the EXAMPLES/PCHOST or EXAMPLES/IODEVICE directory. The source code is in a format suitable for direct input into Visual Basic or into the
uVision Integrated Development Environment. The source code is also viewable from this browser.

Return to Top

Overview of PC Host Software
The PC Host software is written is Visual Basic to hide some of the complexity of writing Windows Applications Programs. The source code for all of the examples is included on this CDROM. The Learning Edition of Visual Basic is adequate to support all of the example programs. Project files are included and these can be found in the EXAMPLES directory.
Before running the programs please copy the two files from the CDROM's Windows/System directory into your C:/Windows/System directory. These two files are There are two interface modules used by the example programs:
Return to Top

Overview of IO Device Software
The IO Device software is written in MCS51 Assembler code -
development tools are provided on this CDROM to enable you to edit and regenerate all of the examples.

All of the examples use an EZ-USB Development Board from Anchorchips - when special hardware was required for an example, this was built on an Anchorchips EZ-USB breadboard.

The examples co-exist with the dScope monitor that is initially downloaded into the program memory. The dScope monitor requires access to Serial Port 1 (and it's IO pins), it's interrupt vector and Timer 0 for baudrate control. The examples stay clear of these IO features and the dScope program space. The examples use Port A as an 8-bit OUTPUT port. An 8-bit INPUT port is created using the upper 4 bits of Port B and the lower 4 bits of Port C (dScope is happy with this assignment).

Chapter 6 describes six modules. Of these, three are common for all examples:
Return to Top

Display USB Devices, Display HID Devices
The Chapter 4 examples contain all of the detail of working with USB devices.

Display USB Devices contains the low-level system calls to transfer packets between the PC Host and the IO Device. It contains two major modules,
CollectData.frm which works through system tables to discover which USB devices are currently connected to the PC Host and DisplayUSB.frm which tabulates the IO Device Descriptor Data in an easy-to-comprehend format. It is an interesting application to study.

Display HID Devices is a high level interface that accesses the IO Devices using a "file-style" interface, ie Open, Close, Read and Write. Most of Display HID Devices is converted into the HIDinterface.bas module that the other examples will just call.

Return to Top

Buttons and Lights
There are two halves to the Buttons and Lights example, the PC Host side and the IO Device side. The modules that are unique to this example are:
Return to Top

Reader Board
There are two halves to the Reader Board example, the PC Host side and the IO Device side. The modules that are unique to this example are:
Return to Top

Reader Board with Dual Configurations
There are two halves to the Reader Board example, the PC Host side and the IO Device side. The modules that are unique to this example are:
Return to Top

I2C Development System
There are two halves to the I2C Development System example, the PC Host side and the IO Device side. The modules that are unique to this example are:
Return to Top

Thermometer Applications
There are two halves to the Thermometer Applications example, the PC Host side and the IO Device side. The modules that are unique to this example are:
Return to Top

Infrared Applications
Sorry. The Infrared Applications example was not available at the time this CDROM was manufactured. Please download it from my
website

Motor Control
There are two halves to the Motor Control example, the PC Host side and the IO Device side. The modules that are unique to this example are:
Return to Top

Lighting Control Panel
There are two halves to the Lighting Control Panel example, the PC Host side and the IO Device side. The modules that are unique to this example are:
Return to Top