Embedded Muse 109 Copyright 2005 TGG January 26, 2005

You may redistribute this newsletter for noncommercial purposes. For commercial use contact jack@ganssle.com.

EDITOR: Jack Ganssle, jack@ganssle.com

- Editorís Notes
- Thought for the Week
- The Digital I/O Handbook
- Embedded Systems Design using the Rabbit 3000 Microprocessor
- Jobs!
- Joke for the Week
- About The Embedded Muse

Editorís Notes

There are no current plans to host a public Better Firmware Faster seminar, but I often do this one-day seminar on-site, for companies with a dozen or more embedded folks whoíd like to learn awesome ways to build firmware more efficiently. See https://www.ganssle.com/onsite.htm.

Weíre overwhelmed with jobs this week; letís hope that says something good about an improved business climate in this industry. In fact, Iím releasing the Muse a bit earlier than planned just so these job offerings donít go stale.

Thought for the Week

In the January, 2004 (yes, last yearís) IEEE Computer Jesse Poore made a comment that keeps running around in my head. He wrote: ďTheoretically, software is the only component that can be perfect, and this should always be our starting point.Ē


Hardware can be made incredibly reliable. But it still breaks. Perfection is not only practically unattainable, the Second Law of Thermodynamics guarantees that no amount of effort will result in perfection. So for the most critical of applications we resort to multiple independent units, and still at best reduce the chance of failure to some non-zero probability.

But software never breaks. It quietly does whatever we told it to do.

Itís not easy to get software perfect, and in fact in many cases that goal may be practically impossible. But thereís nothing implicit in code that leads to bugs. Imperfect software stems from poor programming practices, insane schedules, and all of the usual well-known factors.

Both hardware and software are human creations, so both suffer from human frailties. But only the circuits and devices are intrinsically flawed. If we do better, we can at least approach perfection with the code.

And thatís a happy thought.

The book starts with a quick introduction to logic, which emphasizes the electrical, rather than the Boolean, nature of real devices.

A chapter on outputs is equally practical. The authors talk about using buffer chips and transistor circuits to drive relays (solid state and otherwise) and optoisolators. The chapter on inputs talks about real-world problems like bounce and circuit isolation. Youíll learn how to compute the values of pull-ups, LED resistors, and the like.

The final chapter on interfacing to sensors walks the reader through using thermal switches, Hall-effect sensors, encoders and more.

What I like most about the book is its mix of hardware and software. Most pages have a bit of code plus a schematic. All code snippets are in C.

This is a great introduction to the tough subject of tying a computer to the real world. Itís the sort of quick-start of real value to people with no experience in the field.

I havenít seen it on Amazon, but you can get it from http://sealevel.com/product_detail.asp?product_id=810&%5F .

Systems Design using the Rabbit 3000 Microprocessor

Systems Design using the Rabbit 3000 Microprocessor, by Kamal Hyder and Bob Perrin, (ISBN: 0750678720) is a complete introduction to programming with this popular microprocessor.

Rabbit Semiconductor (http://rabbitsemiconductor.com/ ) sells a popular range of 8 bit microprocessors that offer quite high-end performance. My son and I just finished a project for his high school with one, and Iíve used them for a number of other applications. The R3000 is sort of like a Z80 on steroids, with many new instructions, wider address bus and a wealth of on-board peripherals.

Like any modern high-integration CPU the Rabbit offers so much itís sometimes hard to get a handle on managing all of the I/O. This book will get you started, and is a must-read for developers using the part.

The first few chapters describe the CPU in general and the development environment provided by Rabbit (Dynamic C).

Chapter 5, though, is a description of interfacing to the real world, using all sorts of devices. Itís aimed at engineers, not raw newbies, but, for an engineer at least, is an easy and descriptive read.

The chapter on interrupts is one of the best Iíve seen in any book. It covers the hard stuff, like writing ISRs in C and assembly, with real-world examples. If youíre using the R3000 just cut and paste the code into your application.

It seems today that if thereís a transistor in a product then it needs an Internet connection. Rabbit has several development kits that include everything needed to connect to the Ďnet. The authors devote considerable space to networking, but thankfully with only a cursory explanation of protocols. Rather, they give step-by-step instructions on implementing a working network, and conclude with a complete web server for monitoring water sprinklers.

The final chapter covers an alternative toolchain from Softools. Dynamic C is a single-module compile-it-all paradigm thatís highly interactive. Softools (http://www.softools.com/ ) sells a well-supported, reasonably-priced conventional C compiler, assembler and IDE. I only recommend products Iíve used and like, and the Softools products are first-rate.

Systems Design using the Rabbit 3000 Microprocessor is required reading for users of the R3000, and a pretty darn good introduction to the entire realm of embedded systems development as well.


Joke for the Week

Thaddeus Badowski sent in this gem:

An ASCII character walks into a bar.
"How are you today?" asks the barman.
"Not too good, I have a parity error" says the AC.
"I thought you looked a bit off" the barman replies.