README for PD_FSUSB
27 February 2008
Dave Chambers
dlchambers@aol.com
http://www.dlwrr.com/electronics/picdem

The Project

I bought a PICDEM FS USB kit and learned how to use it.
Problem was, the sample Windows code for controlling it was pretty crappy. In particular, it wasn't at all clear how one drives the bootloader from a Windows app. And Microchip doesn't offer the source to their Demo App.

I searched the Web and found the following link to the FS USB WinApp source:
http://www.picbasic.co.uk/forum/showthread.php?p=50705
That is what the Web is all about - techies sharing nuggets of great info!

It turns out that the Demo App source has several shortcomings:
1) It's written in Borland C++ Builder - WTF??? Useless to any real Windows coder.
2) The guy who wrote it is a HORRIBLE programmer so the code is really hard to use as a tutorial.

So I ported it to C++ under MS Visual Studio 8.
This was more than just an academic exercise: It's the groundwork for my own custom app that will control my own custom PIC18F4550-based USB device. Turns out that porting the app to VC++ paid big dividends - it forced me to learn the PC/PIC bootload interface down to the nitty gritty, something I had just skimmed before.

Ownership

My intent is to help others just as they have helped me.
I therefore offer my parts of this code with no restrictions whatsoever, and no attribution is necessary.
However, this code is based on Microchip's Demo App and a scrounged version of it's code, so you may need to comply with any restrictions imposed by Microchip.

Notes on the contents of PD_FSUSB.zip

When you unzip PD_FSUSB.zip, it creates a few subdirs:
When you open the PD_FSUSB project (in the \App dir), notice that under "Source Files" 've created several sub-folders. I did this to make the project less monolithic. The sub-folders are:
Comms
Code related to communicating with the board via USB.
Dialogs
The various dialog boxes.
Misc
UiCtrls
Classes for the custom controls used in the Tabs.
My goal was to make my version's UI look like the original version's UI, and these controls achieve that look.
You don't need to understand any of these in order to understand the interaction with the FSUSB board.

Behavioral differences from the stock FSUSB app

  1. I have "AutoSelect" and "AutoConnect" checkboxes at the top of the dialog. When both are unchecked, the behavior is the same as the stock App.
  2. The "Clear Log" button is at the bottom-right of the log.
  3. The Demo Mode UI includes radio buttons for Celsius and Farenheit. Just because I wanted to.

Debugging tips

If you're wanting to watch the App interact with the board, I'd suggest setting breakpoints in the following locations: