Page 10 - Programming Microcontrollers in C
P. 10
Introduction to First Edition xi
language. But these and other features were included along with other
enhancements in a helter-skelter manner in different compilers as new
compiler versions were created.
In 1983, an ANSI Committee (The X3J11 ANSI C Standards Com
mittee) was convened to standardize the C language. The key results of the
work of this committee has been to create a strongly typed language with a
clear standard library. One of the constraints that the ANSI committee
placed upon itself was that the existing base of C code must compile error
free with an ANSI C compiler. Therefore, all of the ANSI dictated typing
requirements are optional under an ANSI C compiler. In this text, it is
always assumed that an ANSI compliant compiler will be used, and the
ANSI C form will be used throughout.
C compilers for microcontrollers—especially the small devices—
must compromise some of the features of a compiler for a large computer.
The small machines have limited resources that are required to implement
some of the code generated by a compiler for a large computer. When the
computer is large, the compiler writer need not worry about such problems
as limited stack space or a small register set. But when the computer is
small, these limitations will often force the compiler writer to take extraor
dinary steps just to be able to have a compiler. In this book, we will
discuss the C programming language, not an abbreviated version that you
might expect to use with some of the smaller microcontrollers. In the
range of all microcontrollers, you will find components with limited
register sets, memory, and other computer necessary peripherals. You will
also find computers with many megabytes of memory space, and all of the
other important computer features usually found only on a large computer.
Therefore, we will discuss the language C for the large computer, and
when language features must be abbreviated because of computer limita
tions, these points will be brought out.
All of the programs found in this book have been compiled and tested.
Usually source code that has been compiled has been copied directly from
computer disks into the text so that there should be few errors caused by
hand copying of the programs into the text. The compilers used to test
these programs are available from Byte Craft Ltd. of Hamilton, Ontario,
Canada (for the MC68HC05) and Intermetrics of Cambridge, Massachu
setts (for the MC68HC11 and MC68HC16). If you wish to develop
serious programs for any of these microcontrollers, you should purchase
the appropriate compiler from the supplier.
How does one partition a book on C programming for microcontrollers?
First, the text must contain a good background on the C language. Second,
it is necessary to include a rather extensive background on some
microcontrollers. Finally, C must be used to demonstrate the creation of
code for the specified microcontrollers. This approach is used here. The C