Page 6 - Programming Microcontrollers in C
P. 6
Introduction to Second Edition
Today, even more than when the first edition of this book was written,
the use of microcontrollers has expanded to an almost unbelievable level.
A typical car has 15 microcontrollers. A modern home can have more than
50 microcontrollers controlling everything from the thermostat, to the
furnace, to the microwave. Microcontrollers are everywhere! In the mean
time, many new chips have been placed on the market as well.
Also, there have been significant modifications to our programming
languages. The standard C language is now called C99 rather than C89.
There have been several changes in the language, but most of these
changes will not be available to us for some time. Many of the modifica
tions to the language will be of little use to programs for embedded
systems. For example, complex arithmetic has been added to the lan
guage. It is rare that we use even floating-point arithmetic, and I have
never seen an application for an embedded system where complex arith
metic was needed. However, other additions allow improved optimization
processes, such as the restrict keyword and the static keyword used to
modify the index of an array. Other changes have less impact on the
generation of code, such as the // opening to a single line comment. Also,
today you will have no implicit int return from a function. All in all,
expect the new versions of C compilers to be significant improvements
over the older versions. Also, expect that the new compilers will not break
older code. The features of the new standard should begin showing up in
any new version of the compilers that you use.
The C++ standard committee has completed its work on the first
language standard for C++. There is much clamor about the use of C++ for
embedded systems. C++ as it stands is an excellent language, but it is
aimed primarily at large system programs, not the small programs that we
will be developing into the future. C still remains the grand champion at
giving us embedded programmers the detailed control over the computer
that we need and that other computer languages seem to overlook.
The first six chapters of the book have been revised and any errors that
were found were corrected. Every chapter has been altered, but not so
much that you would not recognize it. Chapter 7 has been added. In that
chapter, a relatively complex program is developed to run on the
M68HC912B32. The development system was based on this chip and it
had no significant RAM to hold the code during development. Therefore,
all of the code was completely designed, coded, and tested on a DOS
vii