Microchip's PIC family of microcontrollers are very popular in the hobbyist electronics world. They are inexpensive, powerful enough for many tasks, widely available, and have great support online. PICs aren't the absolute easiest way to get into digital electronics (that honor would probably fall to the Parallax BASIC Stamp or to Lego Mindstorms) but it's well within the abilities of a great many electronics hobbyists.
This review covers three of the better books on PIC programming.
PIC in Practice
by D. W. Smith
255 pages, softcover
$26.95, Buy it at Amazon.com
Last update: 2004.09.18
This small book is a gentle introduction to PIC programming for one who has elementary programming and electronics knowledge already. It doesn't spend a lot of time explaining basics. In exchange, it gets to the meat of the task quickly: the book's first working program and circuit starts on page 14. As a programmer and electronics hobbyist already, I appreciated this early emphasis on concrete examples. It helped me to quickly wrap my head around the core concepts of PIC programming.
The downside of this book is that it is unauthoritative and thin on details. The book covers only a few common devices in the PIC family, and it has no "reference" qualities. For instance, try looking up TRIS in the book's index, and you will simply be referred to the places where the TRIS register is accessed in code. If you study the code and terse explanatory text, you'll glean that the code somehow sets up the chip's I/O features for the program's needs, but nowhere is the concept behind this register explained. You don't even learn that TRIS stands for "tri-state"! Apparently one is meant to find this information in the PIC's datasheet.
I found several errors in this book, all of which I recall being of the "authority" type: the book will say something vague which isn't completely correct. This is a consequence of its brevity.
Programming and Customizing PICmicro Microcontrollers
by Myke Predko
1190 pages, softcover
$49.95 list, Buy it at Amazon.com
Last update: 2005.10.28
This book's title is as symptomatic of verbosity as the previous book's is of brevity. This is a big book. You can't read it one-handed without experiencing wrist strain. Earlier printings even included a CD-ROM containing (among other things) two additional chapters covering the basics of software development and electronics. This illustrates the vast difference in style between this book and the Smith book: clearly Predko wanted this book to appeal to anyone who wanted to use a PIC, and he wasn't about to let the possibility that some readers might not be ready to read the book stop him.
In further contrast to the Smith book, you don't get to a working program and circuit until Chapter 15, beginning on page 663! Prior to that, Predko drags you through everything from the PIC instruction set to program requirements analysis to a comprehensive review of PIC development tools. As an experienced developer, I found much of this material a hard, dull slog. There's nothing new here to engage the interest of anyone who's been programming for a while.
An interesting feature of this book is that it comes with a bare PCB for a basic PIC chip programmer. (That's the hardware you use to "blow" code into the PIC.) This is a really neat idea: buy the book, and place a parts order for what you need from a distributor, and you're up and running for very little money. Unfortunately, my programmer doesn't work despite a lot of troubleshooting and trying it with four very different computers. The book comes with detailed test procedures for the board, and I got wildly different test results with each machine. This suggests that the programmer's design depends too much on the details of how each machine implements the weakly-defined PC parallel port standard. No doubt there is a class of machines that this programmer does work with, but I didn't find an exemplar among a collection ranging from an original Pentium 100 through a Pentium IV 2.4 GHz. Take my advice: save the money you'd spend on parts to complete this project and put it towards a PIC programmer that uses a serial or USB port. These ports are rigidly standardized, compared to the parallel port.
Another problem with this book are the copious typographic errors. Some are significant, but the vast majority are just careless errors. For instance, frequently a zero is used in place of an oh — or vice versa — in an acronym or assembly language symbol. Another annoyance is the use of "I2C" instead of Philips' name for the protocol, "I2C". These niggles are distracting. Speaking of typography, the book religiously uses "PICmicro®" everywhere. Clearly Microchip's legal team won a battle here over both common sense and common legal interpretation of trademark law.
The Quintessential PIC Microcontroller, 2/e
by Sid Katzen
Springer Verlag, 2005 (2nd printing in 2007 with corrections and additions)
567 pages, softcover
$59.95 list, Buy it at Amazon.com
Last update: 2007.12.01
Katzen's book splits the difference between the previous two books, producing a very nice balance between verbose theorizing and concrete tutorializing.
The book gets off to a bit of a slow start, covering basic digital electronics and computer theory in the first seventy-odd pages. Programmers with only high-level experience and analog electronics engineers will get the most out of this. Anyone who has worked with other microcontrollers can safely skip it.
This book takes a different path from the other two when it comes to presenting code. There is only one fully realized project in the book; that is, a complete schematic plus software to run on the hardware. It's in the last chapter, where the author ties together all of the threads he's spun through the rest of the book. There is copious code throughout in the book, but none of it would give interesting results when run as-is on a bare PIC. For example, there are several useful delay routines, but watching a PIC run a delay routine is less interesting than watching paint dry; at least you can observe a change when watching the paint. To be fair, it could be educational to run some of this code in a simulator. What is really wanted, however, is a trivial PIC circuit plus software to run on it very early on in the book. In the software world, we have "Hello, world!" programs. Every introductory PIC book should have the equivalent, an LED blinker. Without something like this, it's like an all-lecture physics course, with no lab work. Successfully running real code on real hardware is reassuring and rewarding for a raw newbie.
Katzen's prose is detailed without bloviation. The book has no reference section per se, but rather the whole book is reference-worthy. Much like The Art of Electronics, you get the impression that you can look something up in the index later and find useful material almost every time. Also like AoE, the book is thoughtfully typeset, with useful diagrams and illustrations on almost every page. (The typesetting and diagrams are further improved in the second edition.)
As someone who has already read the first edition, I found that the most valuable improvement in this edition is the coverage of newer devices. Of particular note are coverage of the 8-pin PIC12F675 micro powerhouse, and a brief chapter covering the enhancements in the PIC18F series as compared to the standard range devices.
There are about 80 more pages in this edition compared to the first. Only about 20 of those pages are easy to account for directly. A quick comparison of the two editions' tables of contents reveals that some chapters are actually shorter in this edition. The writer in me interprets that as evidence of a lot of rewrites for clarity. Often a briefer explanation improves the prose, while at other times more detail offers a bigger improvement.
This edition corrects most of the errors I found in the first edition, and the current errata list on the author's web site covers the most serious of the errors I've found in this edition. Since updating this review for the second edition, there has been a second printing which includes fixes for most of these errata. The errata list on the author's site remains active, so readers can continue to "patch" their books.
All in all, these improvements make buying the second edition a must if you still use your first edition copy. If you don't yet have a copy, see the next section for my overall verdict.
Okay, "desert island" time: if I had to pick only one of these books, which one would it be? It would make me unhappy to be forced to make that choice, but it would have to be the Katzen book. This book is short enough (and light enough!) to read casually yet detailed enough to act as a reference when you don't want to wade through Microchip's datasheets.
The main problem with the Katzen book is the lack of a "toy" program early on in the book. Therefore, I would be much happier if I were allowed to pick two books, so I could also take the Smith book. It offers the best introduction to PIC programming of these three, and it's cheap enough that it's not a problem that it has little value beyond that first reading.
Some may be tempted by the completeness suggested by the Predko book's wide spine. In the year since doing the initial version of these reviews, I didn't pull it off the shelf once. I later gave my copy away and haven't missed it in the years since. Anything it covers that the other two don't can be found on the Internet, particularly in Microchip's fine datasheets and application notes. Save yourself the wrist strain, bookshelf space, and expense: give this one a miss.
Newnes has a web page for the Smith book here.
This article is copyright © 2004-2016 by Warren Young, all rights reserved.
|Updated Sun Jan 18 2015 04:24 MST||Go back to Electronics Book Reviews||Go to my home page|