Efficient Design With Microcontrollers (Part 1)

[I take the next few posts from C and the 8051]

An efficient microcontroller application involves designing with a minimum of external hardware necessary to allow the software to keep up with all of its tasks.

Efficient is not always an intuitive or even obvious concept. With many years’ experience in assisting customers and teaching students, I have strong personal opinions about what constitutes efficient use of microcontrollers and enumerate a few below:

  1. Transfer as much of the project’s functionality as possible to software. Only if you can have just one processor, and it is quite busy, should you allow yourself more hardware.
  2. Use as few port pins as possible.
  3. If you transfer debouncing and calibration to software, you reduce construction costs and simplify hardware troubleshooting. (Debouncing is discussed beginning on page 321.)
  4. Use functions rather than straight-line programming so code can be re-used.
  5. Use tables, interpolation, and simplified calculations with the smallest-sized variables to make code faster and smaller with simpler math operations.

This is what I mean by “efficient.” Next time I will describe what I see as efficient hardware. Some of these ideas date back many years. Do you think they are outmoded with the higher-performance ICs available today?

Moderated Comments Only

I am getting strange (no follow) comment traffic with no written content and nothing to do with my posts or the site, so I am forced to require all comments to be moderated. I apologize for the delay for those of you with actrual comments–I have no desire to limit friendly (or critical) comments, and anything on topic will be approved. I will try to approve every day.

Why the personal computer diverged from the embedded computer

It may surprise you “young” readers to hear that for many years there was no difference between a computer used for dedicated applications and one that could run different programs at different times! When Intel’s 8-bit 8008 gave way to the 16-bit 8086 they also produced the 8-bit-interface 8088; the next step had the 80286 but still had the (I believe 8-bit-interface) 80186; the 80286 led to the 386, and the 486. after “4” the marketing folks substituted “Pentium” for “5”; since then the non-dedicated program market has moved out of sight. Continue reading

A new e-book?

In checking if this (newly moved) web site was coming up on search engines, I did a search for the title, C and the 8051. It was a surprise!

I have known for some time that my ex-publishers chose to (illegally) permit the third edition on Google books and that someone had scanned in the entire 4th edition (also illegally). After chafing for a bit and exploring what steps might be necessary to fight it, I decided it wasn’t worth the effort. Those who want to Xerox about 500 pages will find it costs as much or more than buying the official book and still leaves them without a cover or binding. Continue reading

When knowing Assembly Language is good

Is it vital to programming to know how the computer works? No…probably not with the high-end applications of today. I have only a vague idea of how WordPress is combining the pieces of this post onto your screen and have never made a study of HTML or PHP. But when you are working with low-end computers, closer to the actual machine operations, it can make a difference. Continue reading

Microcontrollers and Emulators

It has been quite some time since integration capabilities first allowed the processor, memory, and I/O to all go on one chip and the name changed from microprocessor to microcontroller

The problem in the early days was the development process–it was quite feasible to get a large quantity of a device built with a fixed program permanently integrated (if you were using a micro in a high-volume application such as an engine controller in an automobile), but getting just one device with a new iteration of a program you were developing was a different matter. Continue reading