Page 24 - Introduction to Microcontrollers Architecture, Programming, and Interfacing of The Motorola 68HC12
P. 24
1
Basic Computer Structure
and the 6812
Computers, and microcomputers in particular, are among the most useful tools that
humans have developed. They are not the news media's mysterious half-human forces
implied by "The computer will decide . . ." or "It was a computer error!" No, computers
are actually like levers; as a lever amplifies what the human arm can do, so the computer
amplifies what the human brain can do. Good commands are amplified, and the computer
is a great tool, but bad commands are likewise amplified, and good commands incorrectly
programmed are also amplified. "To err is human, but to really foul things up, you need
a computer." You have to study and exercise this tool to make it useful; that is the
purpose of this book. The computer also has to be used with insight and consideration
for its effects on society, but that will not be studied in this book.
We shall study the computer as an engineer studies any tool—we begin by finding
out just how it ticks. We make our discussion concrete using the well-designed Motorola
6812 microcomputer, as a means of teaching the operations of computers in general. In
this chapter we introduce basic computer structure. We discuss memory, how memory
words are read to tell the microcomputer what to do, and how these words are written and
read to save the microcomputer's data. Finally, we describe a small but useful subset of
6812 instructions to show how a computer reads and carries out an instruction and a
program, to introduce the idea of programming.
After reading this chapter, you should be able to approach a typical instruction, to
be introduced in the next two chapters, with an understanding about what the mnemonic,
the machine code, and a sequence of memory reads and writes may mean for that
instruction. This chapter then provides background for the discussion of instructions that
we will present in the next two chapters.
1.1 Basic Computer Structure
What is a microcomputer, and how does it execute the instructions that a programmer
writes for it? This question is explored now at a level of abstraction that will be adequate
for this text. We do know that many readers will object to one aspect of the following
1