ChipCenter Questlink
SEARCH CHIPCENTER
Search Type:
Search for:




Knowledge Centers
Product Reviews
Data Sheets
Guides & Experts
News
International
Ask Us
Circuit Cellar Online
App Notes
NetSeminars
Careers
Resources
FAQ
EE Times Network
Electronics Group Sites

EE Expert Robert Ashby
SpacerEmbedded Engineering

Click Here for the Embedded Engineering ArchiveClick Here for the Embedded Engineering Main EE Expert PageClick Here for the Guides and Experts Main Page

Debugging Methods:
A Display is a Terrible Thing to Waste

by Robert Ashby

I have long believed that the best debugging tool for a microcontroller is often the microcontroller itself.ı If your design experiences are anything like the ones that I have in the World of Robert, you get 80% of the design done in 20% of the time spent and spend the last 80% of the time working out 20% of the bugs.ı If you have ever been in this situation, then youıll soon realize that debugging methods integrated into your design are worth the investment.

Iıve programmed more consoles than I care to count and yet Iım still finding debugging methods that I wish that I had thought of years ago. This is a very broad topic for one article, so I will break down a typical Robert design into parts and discuss them in turn. I start with displays.

Use the Display
The display system of your design should be of utmost importance. This ever present, easy-to-use tool means less down time, and more robust designs.ı It not only helps me to quickly move through a design and helps me to quickly locate system problems external from the microcontroller, it also helps me to find improvements for the next version of software. If your design has a display, I would almost invariably say that the primary task of the programmer is to get that display working first.ıThe display can be used as an excellent debugging tool.ı Itıs a shame to let it go to waste.

The display doesnıt need to be fancy to be useful.ıı Many of the designs that I work with have 7-segment displays.ı Some designs might only have a couple of LEDs.ı Sometimes, the design doesnıt have any device that would qualify as a display.ı In that case, I try to leave a meter hooked up to an output pin, or might even incorporate some temporary LEDs into the design to be used during development only.

Try to have a flexible routine written for printing to your display.ıı If you have several display areas, use one routine for printing that accepts both the number to be printed as well as the display location where it is to be printed as variables passed into the routine call.ı If you have a simple collection of LEDs, I would create a display routine that will print desired numbers or RAM contents in a binary format that is easily read according to how the LEDs are laid out in your design.

The Trouble with ICE (In-circuit-emulator) Systems
ICE (In-circuit-emulator) systems for microcontroller design donıt always run at full chip speed and often wonıt show you RAM contents in real time.ı The run process either needs to be terminated or slowed for the emulator system to display RAM contents.ı Using your display as a debugging tool to show RAM contents as your code executes allows you to display desired values as often as you would like without stopping execution and without setting break points.ı It is an inexpensive way for smaller organizations or go-it-alone programmers to get some of the advantages of more expensive systems, simply by utilizing their designs better.

Show Me What You Have
As you work to get the rest of your design going, youıll find that your display is useful to let you know what the value of a mystery register at a particular moment, or it will let you know when a particular flag is set or cleared.ı It can be used to show accuracy in calculations, feedback values, show current input states.

Even a simple display can be used to help you cut down on your head scratching and build a more reliable product.ı I recommend that you consider different debug modes for information that you might want to pull from the microcontroller on a regular basis.ı For example, there is a mode in most of our treadmill products that allows the user to see accumulated time and distance on our product.ı It also displays the setting of a stored bit to show whether the product is set up for English or Metric measurements for speed and distance.ı I have also implemented modes that allow me to see key inputs, speed feedback, control output, and set speed variables.ı The grouping of specific areas of console operation and quick access to key values allow me, or any technician, to quickly troubleshoot most common problems during product operation without ever hooking up a meter or removing a plastic shield.ı

So remember: a display is a terrible thing to waste.

Embedded Engineering Archive

Guides and Experts   Analog Avenue   EDA Tools   PLD   DSP   EDA   Embedded Systems   Power   Test
Click here to get your listing up.

Copyright © 2003 ChipCenter-QuestLink
About ChipCenter-Questlink  Contact Us  Privacy Statement   Advertising Information  FAQ