Page 164 - Programming Microcontrollers in C
P. 164
Chapter 4
Small 8-Bit Systems
Not surprisingly, writing code for any microcontroller—whether
in assembly language or a high-level language like C—requires a
detailed knowledge of the microcontroller being programmed. Usu
ally, a high-level programming language requires little knowledge
of the underlying computer on the part of the programmer. This ap
proach allows the programmer to concentrate on the nature of the
problem being solved rather than how to squeeze the problem into a
specific computer. A C abstract computer has been designed and you
write code for this computer when you write C code. The abstract
computer has no registers, control registers, index or address regis
ters, or any other of the normal resources found on a typical computer.
The language is sufficient to allow proper creation of code needed to
run the core computer. However, the essence of any microcontroller
is the special on-board peripherals that it provides. These peripherals
are not directly available from the C language either.
Programming techniques must allow use of these peripherals or
the high-level language is valueless. Three distinct levels of
microcontrollers will be covered in different sections of this text. The
simplest microcontroller is embodied in the M68HC05 family. These
8-bit devices are usually completely self-contained and do not support
an expanded bus. Another level of complexity is found in the M68HC08,
the M68HC11 and the M68HC12 families. These computers are also
8-bit machines, but they have more registers than the M68HC05 fam
ily and support an expanded data bus. With the expanded data bus,
these families can have external memory and peripherals in addition to
those within the chip itself. (The peripherals on these chips are not
very different from those found on the M68HC05.) The step up in
computer power is the M68HC16 microcomputer. This computer is a
149