Getting started with Brad Minch's USB applications

1. Download

and unzip it into directory c:\lab1.

2. Download device driver libusb-win32:

3. Using gzip and tar unpack libusb-win32 into a suitable temporary directory (e.g. c:\temp).

4. Copy the two files lab1.inf and from c:\lab1c\libusb to that libusb-win32 device driver bin sub-directory (say

5. Plug in the device and wait for the Found New Hardware Wizard

6. Select install from a list or Specific location and click Next

7. Browse to C:\temp\libusb-win32-device-bin-\bin and click Next

8. Wait until the wizard has finished installing the software and click Finish

9. Run testlibusb-win.exe in the C:\temp\libusb-win32-device-bin-\bin directory.
The device details should be displayed.

10. Run c:\lab1\pc\set_config.exe, the LED connected to RA0 should flash.

Compiling the PIC code

Using MPLAB and C18, build Brad Minch's lab1.c program for your target device. His C code will be in the c:\lab1c\pic directory.

If you get an error from one of the pragmas, comment it out.

He also has assembler code:

Program your target.

Compiling the PC applications

1. Download and install MinGW from You need file MinGW-5.0.3.exe, or
whatever the current file is called. Ensure the MinGW compiler is on your path.

2. Copy libusb.a from C:\libusb-win32-device-bin-\lib\gcc to c:\MinGW\lib.

3. Copy usb.h from  C:\libusb-win32-device-bin-\include to c:\MinGW\inc.

4. In the c:\lab1\pc directory, type "gcc set_config.c -o set_config.exe -lusb" resulting in a new PC
executable. Repeat for the other two executables.

5. Download this file: and compile it with gcc 
(see comments for details).

6. Test the executables on your hardware.

You now have everything you need to write your own USB applications.


Here is a little prototyping PCB I designed for experimenting with USB, it won the monthly PIClist
design competition and is ideal for use with Brad's software. The boards are available from Olimex. 
CONN2 is intended for connection to the Microchip ICD 2 or 3 debugger/programmer. Underneath it are the pads for a PICkit 2 or 3.

The schematic is here: usb_2_sch.pdf

Boards may be ordered from Olimex: board order code is PICLIST-07-2006 - 3 boards panellised in 1
DSS panel. Re-order of 1 panel will cost $26.40 (panel) + $3.90 (non std. drills) = $30.30 + shipping.

When programming the 2455, ensure that pin 1 (MCLR/RE3) is configured for digital I/O,
or add a pull-up resistor to Vcc. Otherwise operation will be intermittent with MCLR responding to noise.

Leon Heller