The HCS08 – hereafter called the S08 – is Freescale's current 8-bit microcontroller family. It is a minor update of the HC08 family, which was a major update of the HC05. Freescale retained binary (object) code backwards compatibility – that is, the HC05 instruction set is a strict subset of the HC08, and the HC08 is a strict subset of the S08 – but because the memory map and peripheral blocks have fundamentally changed during these evolutions, it’s unlikely that any actual HC05 binary code would run on HC08, let alone an S08.

So, why use an S08 rather than an HC08?

Features

The S08 adds the following to the HC08:

The pipelined CPU, while it can take one more bus clock than the HC08 for some instructions, can be run much faster. The HC08 tops out at 8 MHz, while many S08 variants can run at 20 MHz, and a few at 25 MHz.

Background debug mode (BDM) replaces the HC08’s ROM bootloader, which implemented a quirky and inefficient bit-banged serial interface. BDM is much faster, and can be used to inspect memory and I/O registers even while the CPU core is running. It’s much more like something you’d see on a 32-bit microcontroller – but it’s built-in to every S08, even if it only costs $0.50.

The clock generators are also really cool. Take, for example, the ICS (internal clock source), the clock generation block found on most newer S08 subfamilies. It combines an external oscillator (to drive an external crystal or resonator), an internal oscillator (trimmable within 0.2% from 31.25 kHz to 39.0625 kHz), and an FLL (frequency-locked loop) with a divider that can be used to multiply either the internal or external oscillator up to 40 MHz.

Mode switching is done completely in software, so the configuration is very flexible. At power-on-reset (POR), the internal oscillator and FLL are configured for a bus clock of 4 MHz (nominally). Nine bits of trim can be stored in flash and written to the ICS at reset to set the frequency very accurately. I’ve successfully used the trim to set a bus clock of 9.216 MHz, which is an integral multiple of 115,200. The ICS clock is stable and accurate enough to drive a UART without a crystal!

References

For the full story, read the S08 family reference manual. Freescale’s book Understanding small microcontrollers is a tutorial introduction to their HC05 microcontroller family. Since the HC05 is a predecessor (ancestor?) of the S08 and shares much of the instruction set with it, much of that book would be relevant to the S08.

Suggested subfamilies for experimentors

I have some “favorite” S08 parts. There are many subfamilies, some designed for very specific uses. But there are also good general-purpose parts. Here is a short list of my favorites.

S08QG

This is the first S08 part I got working. I ordered a few samples of the S08QG8 in a DIP 16 package, along with a few 908QB8s. I ended up using the 908s to “bootstrap” the QG8s, via the background debug mode (BDM) pin on the QG.

With the exception of a serious silicon erratum on the parts that I have – which suggests running the part at half speed (5 MHz) because the clock doesn’t run reliably at 10 MHz – I like these parts. 8 KiB of flash, a UART, a 16-bit timer with two capture/compare channels (thus two channels of hardware PWM) – all on a DIP 16 that costs $1.

S08QE

An upgrade to the S08QG. This comes in the same flavours as the QG (DIP 16, 4 KiB and 8 KiB flash) but also in larger packages with more flash and RAM – up to 128 KiB flash.

The S08QE32 in SOIC 28 is a really nice sweet spot. They cost around $2, are easy to prototype (with dipmicro's proto boards, or other SOIC “breakout” boards), have 12 timer channels and two UARTs, and run at 25 MHz.

S08JS

This is an interesting chip. Unlike most other S08’s, which must be programmed by external means using BDM, the JS has a USB bootloader in ROM, making it very easy to prototype with. (See my instructions for building a JS16 USB board.) It’s also very cheap – $1.50 or so in unit quantity – but unfortunately only comes in an SOIC package, so it’s not quite as approachable as a Microchip PIC USB part in a DIP. But it’s not too bad. I’m not great with a soldering iron, but I was able to put together two JS16 boards in a few hours, and both worked the first time (the ROM bootloader successfully enumerated over USB).

S08JM

This is a sort of “upgrade” of the S08JS, even though it came first. It’s more like a cross between the S08QE and the S08JS – USB interface, a good selection of timers, UARTs, etc, and up to 60 KiB of flash. Unlike the S08JS, it has no ROM bootloader, so it must be programmed over BDM. And it only comes in LQFP packages.