Page 136 - The Art of Designing Embedded Systems
P. 136
Hardware Musings 123
Microcontrollers do pose special challenges for designers. Since a
typical part is bounded by nothing more than I/O pins, it’s hard to see
what’s going on inside. Nohau, Metalink, and others have made a great liv-
ing producing tools designed specifically to peer inside of these devices,
giving the user a sort of window into his usually closed system.
Now, though, as the price of controllers slides toward zero and the
devices are hence used in truly minimal applications, I hear more and more
from people who get by without tools of any sort. While it’s hard to con-
done shortchanging your efficiency to save a few dollars, it’s equally hard
to argue that a 50-line program needs much help. You can probably eye-
ball it to perfection on the first or second iteration. Again, appropriate
technology is the watchword; 5000 lines of assembly language on a 6805
will force you to buy decent debuggers . . . and, I’d hope, a C compiler.
You can often bring up a microcontroller-based design without a
logic analyzer, since there’s no bus to watch. Some people even replace the
scope with nothing more than a logic probe.
An army of tool vendors supply very low-cost solutions to deal with
the particular problems posed by microcontrollers. You have options-lots
of them-when using any reasonable controller-far more than if you de-
cide to embed a SPARC into your system.
Some companies cater especially to the low end. Most do a great job,
despite the low cost. I recently looked at Byte Craft’s array of compilers
for microcontrollers from Microchip, Motorola, and National. Despite the
limited address spaces of some of these parts, it’s clear a decent C compiler
can produce very efficient code.
One friend cross-develops his microcontroller code on a PC. Using C
frees him from most processor dependencies; compile-time switches select
between the PC’s timer/UART, etc., and that contained in the controller.
He manages to debug more than 80% of the code with no target hardware.
Working in a shop using mostly midrange processors, I’m amazed at
the amount of fancy equipment we rely on, and am sometimes a bit wist-
ful for those days of operating out of a garage with not much more than a
soldering iron, a logic probe, and a thinking cap. Clearly, the vibrant action
in the controller market means that even small, under- or uncapitalized
businesses still can come out with competitive products.
Watchdog Timers
I’m constantly astonished by the utter reliability of computers. While
people complain and fume about various PC crashes and other frustra-
tions, we forget that the machine executes millions of instructions per

