1. Download lab1.zip: http://pe.ece.olin.edu/ece/projects/lab1c.zip and unzip it into directory c:\lab1. 2. Download device driver libusb-win32: http://prdownloads.sourceforge.net/libusb-win32/libusb-win32-device-bin-0.1.10.1.tar.gz?download. 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 lab1.cat from c:\lab1c\libusb to that libusb-win32 device driver bin sub-directory (say c:\temp\libusb-win32-device-bin-0.1.10.1\bin). 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-0.1.10.1\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-0.1.10.1\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: http://pe.ece.olin.edu/ece/projects/lab1_18F2455.zip Program your target. Compiling the PC applications 1. Download and install MinGW from http://www.mingw.org/. 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-0.1.10.1\lib\gcc to c:\MinGW\lib. 3. Copy usb.h from C:\libusb-win32-device-bin-0.1.10.1\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: http://www.leonheller.com/usb/tst.c 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 firstname.lastname@example.org