The HC08 is Freescale's previous generation 8-bit microcontroller family. It has been superseded by the Freescale HCS08 (hereafter called simply S08), a superior family in every respect. No new design should be based on the HC08! Use the S08 instead.

The HC08 is closely related to, and its instruction set is a superset of, its predecessor, the HC05. The HC08 improves upon the HC05 in the following ways:

I think that’s about it, but that’s a huge improvement. Computation and comparisons with signed numbers are supported, and the RAM and stack can be arbitrarily large; on the HC05 both the stack and the i/o ports had to fit into the first 256 byte page of memory.

Object code for the HC05 can run unchanged on an HC08 – assuming that the i/o ports are the same.

Debugging and bootstrapping

When I first started, in earnest, to explore the HC08 & HCS08 and to build support for them into muforth, I started out not with an S08 part, but an HC08 – in particular, the MC908QB8, of which I had several samples in a DIP 16 package. Unlike the S08 parts, which come blank from the factory and can only be programmed via the single-wire BDM debug interface, the HC08 parts come with a small ROM bootloader, and can be flashed over a clunky and slow half-duplex serial interface.

My first challenge was to get this interface working, then to get some code into the RAM and execute it, and finally to figure out how to program the flash memory. The code I ended up flashing was a combination “debug stub” and BDM-over-serial interface, so I could talk to the HC08 “host” more easily over the normal serial port – the bootloader interface is bitbanged on a normal i/o pin – and use it to program “target” S08 chips over their BKGD pin.

This went slowly, but eventually I was able to get the BDM code working and successfully programmed an S08QG8 chip – also a DIP 16, easily breadboardable part. Once I had code running on that chip – I programmed the same debug stub and BDM “host” code onto it that I was running on the 908QB8 – I could ignore the HC08 part – forever.

Which is just as well, because not only are they are Not Recommended for New Designs by Freescale, but they are no longer available in a DIP 16 package.

Ironically, not long after undergoing this arduous but extremely educational bootstrapping process, Freescale introduced the S08JS family – a chip with a full-speed USB interface, and a USB bootloader in ROM. While not a DIP part, it comes in a not-impossible-for-mere-mortals-to-solder SOIC 20 package, and with the help of a prototyping board from dipmicro and my trusty Weller WTCPT iron, I was able to put together a board in short order. After understanding Freescale’s USB bootloader protocol and writing support for it into muforth, I could now program the JS16 over USB, and because I had equipped it with a BDM “host” interface, I could use it to program other S08 chips. I had to be careful about voltages, however: the JS is a 5v part and most of the S08’s I was trying to program with it (S08QG and S08QE parts, mostly) are 3v parts.

The good news in all this is that no-one needs to re-create the bootstrap process I went through with the 908QB8, and can instead jump directly into the world of the JS16. It’s pretty easy to build a JS16 USB board.