circuitcellar.com
Magazine Support   Digital Library   Products & Services   Suppliers Directory 
 
 





 

March 2006, Issue 188

Remedy for USB-to-MCU Pain
Embedded USB with HIDmaker FS


by Fred Eady


Start USB Medicine Show Good USB Medicine Popping USB Pills Relief How Do You Feel? Sources and PDF

GOOD USB MEDICINE

Dr. Bob actually wrote me two prescriptions: one for hardware and one for software. The former was filled by the MicroEngineering Labs pharmacy in the form of the LAB-XUSB development board (see Photo 1).

(Click here to enlarge)

Photo 1—There’s nothing fancy about the hardware design of the LAB-XUSB. The keypad is a 4 × 4 multiplexed set of push button switches controlled by port B. The 2 × 20 LCD is in a 4-bit configuration off of the lower nibble of port D. The USB is a plus because this board is good for general-purpose work as well.

 The LAB-XUSB’s most prominent features are a 2 × 20 LCD and a 4 × 4 keypad array. The empty sockets are for adding options such as an ADC, an I2C EEPROM, and a Dallas Semiconductor DS1302 real-time clock. Pad area for a Dallas DS18S20 temperature sensor is also allocated. There’s even a pin set for connecting a standard hobby servo to the LAB-XUSB’s 40-pin microcontroller.

The LAB-XUSB is designed to host any 40-pin PIC that’s pin-compatible with a PIC16F877 or PIC18F452. The LAB-XUSB also has a nasty little RS-232 port to support microcontrollers that aren’t capable of communicating via USB. 

I was interested in USB and the LAB-XUSB included a type-B female USB connector, so the USB-capable PIC18F4550 was my microcontroller of choice. As further treatment for the overuse of RS-232, any USB code generated for the PIC18F4550 is programmed into the part using the new MicroEngineering Labs USB programmer shown in Photo 2. You may download the LAB-XUSB’s schematic diagram from the MicroEngineering Labs web site (www.melabs.com/downloads/labxusch.pdf). There are no schematics for the USB programmer.

(Click here to enlarge)

Photo 2—This is an upgraded version of the MicroEngineering Labs serial programmer (which you can still buy). I found that I could hook up a USB cable to the USB programmer and another USB cable to the LAB-XUSB and not have to remove the USB programmer between spins. If you use the keypad area, you’ll most likely have to remove the USB programmer between program and test cycles. The PIC programming pins are multiplexed with the two most significant bits of port B.

The software side of my double-whammy USB prescription came from Dr. Bob’s mortar and pestle. The HIDmaker FS is the big brother of the original HIDmaker. The “FS” stands for “full speed” in the name of the latest version.

In a nutshell, HIDmaker FS generates both the peripheral and host-side USB code necessary for establishing a simple USB communications session between the host and USB peripheral. By generating code that conforms to the USB HID class, HIDmaker FS eliminates the need for a specialized USB device driver. Mr. Gates’s most recent Windows products already know how to handle a HID-class USB device.

It’s a good thing to have something like HIDmaker FS to do all of the USB dirty work for you on both sides of the USB link. But HIDmaker FS isn’t intended to be a USB crutch. If you take advantage of all of its features, you’ll ultimately begin to understand the USB architecture. If you apply yourself, you can teach yourself the art of USB implementation. 

One such educational feature is the USB Advisor, who’s always available to answer questions. Interestingly, the guy in the USB advisor windows is pictured wearing a stethoscope and reading from a chart. What does that tell you?