Table Of Content1
Introduction to Computer Hardware
Objectives
IAntroduction to Cfomputter Hardewarer completing this chapter, you should be able to:
◗ Describe the fundamental elements of every computer system: proces-
sor, memory, and input/output
◗ Compare elements of the HC11 block diagram to the fundamentals of
every computer system
◗ Describe the use of busses to connect computer elements
◗ Explain the three major functional units of a processor
◗ Illustrate the typical registers inside the processor
◗ List the HC11 processor registers
◗ Discuss the HC11 processor modes
◗ Compare and contrast various memory types
◗ Describe the on-chip memory of the HC11
◗ Specify input/output functions present on most computers
◗ Use some basic BUFFALO commands to control the EVBU
Outline
◗ 1.1 Elements of Every Computer
◗ 1.2 Elements of Processors
◗ 1.3 Introduction to Memory
◗ 1.4 Memory Types
◗ 1.5 Input/Output
◗ 1.6 EVBU/BUFFALO
Technician’s Guide to the 68HC11 Microcontroller
Introduction
Computer systems have been developed for a variety of functions and purposes.
General-application desktop machines are the most common. They run a variety of
software applications, such as word processing, financial management and data
processing. They have all but replaced the typewriter as a necessary business tool.
Computers are also present in automobiles, appliances, airplanes and all types of
controllers and electromechanical devices.
Despite the differences among these computer systems, they all share fundamental
components and design. The purpose of this chapter is to provide an understanding
of the fundamental components of a computer system. A conceptual presentation
regarding the elements of every computer system is made with sufficient detail to
establish a foundation for these concepts. The concepts will then be extended to the
HC11 hardware.
1.1 Elements of Every Computer
All computers are made up of a group of three fundamental elements: a central
processor, memory, and input/output devices. Figure 1.1 shows a block diagram of a
computer that includes these three elements. The examination of any kind of desktop
computer, workstation or computer control system will reveal at least this minimum
structure. Many computing devices will have multiple processors, multiple memory
types, and numerous input/output devices. In many cases, the input/output devices
contain all three elements as a unit. Video cards for personal computers, for example,
always contain a video processor and memory in addition to their inherent input/out-
put capability.
Address Bus
Memory
Data Bus
Central
Processor
(CPU)
Connection to the
Outside World
Input/Output
Control Bus
2
Figure 1.1 Fundamental Block Diagram of a Computer
Introduction to Computer Hardware
HC11 Hardware Block Diagram
The HC11 is a computer system on a single chip that contains the three functional
blocks of a computer system. Its internal central processor is a member of the 6800
family of processors; it has on-board memory and sophisticated on-chip input/output
capabilities.
The HC11 block diagram is shown in Figure 1.2. This block diagram is specific to the
M68HC11E9 version of the HC11. This version of the HC11 is used on the development
board (EVBU), as well as in the examples used throughout this text. Three types of
memory are included on-chip: RAM, ROM and EEPROM. The HC11 also supports
expanded off-chip memory. It contains five on-chip input/output functions, an
analog-to-digital converter, and a sophisticated timing system that supports numerous
event-driven functions. The address, data and control busses are not shown in this
diagram; the processor is connected to the memory and input/output functions inside
the HC11 chip in the manner illustrated in Figure 1.1.
3
Figure 1.2 M68HC11E9 Block Diagram
Technician’s Guide to the 68HC11 Microcontroller
NOTE: Throughout this text, references to the HC11 presume the M68HC11E9
version of the chip; thus, the shorter, more general name “HC11” will be used,
unless otherwise specified.
Central Processor
The processor is the device at the center of the machine. It has the responsibility to
execute instructions, manipulate data and perform arithmetic functions. It controls
and manages the activities of the entire machine. The human brain is the ultimate
processor. It can receive and process instructions, process data (like visual images and
sounds) and perform arithmetic calculations. However, the human brain is much,
much more than a processor because it has the ability to think and to reason. Computer
processors cannot think in the same sense.
The term Central Processing Unit (CPU) is used to refer to the main processor in a
system. The CPU often works in conjunction with a set of processors to complete a
whole system. Modern computers contain additional processors, other than the CPU.
They contain video processors, input/output processors, memory controllers, interrupt
controllers and math co-processors, to name a few. Since these other processors are
subordinate to the central processor, they are often called sub-processors. Many
peripheral devices, such as harddrives, printers and video projection systems, have
dedicated processors embedded into their control circuitry.
Memory
Memory is a term that refers to any component that stores data and programs used by
the processor. Memory can have many forms. There are semiconductor memories,
magnetic memories, and optical memories. Semiconductor memories include read
only memory (ROM) and read/write memory (RAM). Magnetic memories include
floppy disk drives, hard disk drives and tape systems. Optical memories include
CD-ROM, DVD and optical disks. A thorough presentation of memory relevant to the
HC11 will be provided in chapter 8. Section 1.3 will address concepts of memory that
are applicable to all computer systems and a necessary foundation for this study of the
HC11.
Input/Output
Input/Output is a term that refers to any subsystem that has the responsibility of
receiving data for the processor (input) or sending data out from the processor
(output). Input/Output is typically abbreviated as I/O and does not necessarily imply
that a particular device has both input and output capability. Typical input devices are
keyboards, mice or scanners. Typical output devices are printers and monitors. Typical
devices that perform both input and output functions are modems or tape drives.
Collectively, all these devices are referred to as I/O devices. The HC11 I/O capability
4
is discussed in detail in chapters 10 through 13.
Introduction to Computer Hardware
Busses
The processor communicates with the memory and I/O via busses. On a computer, a
bus is a set of two or more conductors that are grouped together to form a parallel
information path to and/or from the processor. The bus size, given in bits, is a measure
of the number of conductors that can be active simultaneously on the bus. There are
three major busses on computer systems: the data bus, the address bus and the control
bus.
The data bus is responsible for the transfer of data between the processor and memory or
the processor and I/O. It is a bidirectional bus, because data can travel to or from the
processor and other devices. Typically, a data bus transfers data in byte widths. Thus, a
data bus is an 8-bit, 16-bit or 32-bit bus (1 byte, 2 bytes or 4 bytes wide). The number of
bits, or data bus width, also directly correlates with the default processing capacity of the
processor. Typically, processors and computers are referred to by the size of their data
busses. An HC11 is considered an 8-bit processor because it has an 8-bit data bus and has
the default processing capability of one byte. Pentium-based personal computers are
32-bit or 64-bit machines. Thus, they can process four or eight bytes simultaneously.
The address bus is responsible for the transfer of addresses from the processor to mem-
ory or to I/O. The address is used to identify specific memory locations or I/O devices. It
is a unidirectional or one-way bus, because processors are the only devices that can create
an address for memory or I/O. Typically, an address bus transfers addresses over the bus
in double byte widths. Thus, an address bus is usually a 16-bit, 32-bit, or 64-bit bus (2 bytes,
4 bytes or 8 bytes wide). The HC11 uses a 16-bit address bus.
The control bus is responsible for the control signals necessary to interface the various
devices within a computer system. This bus is not typically structured as a fixed number
of conductors, as are the data and address busses. It is more likely to be a collection of
all other signals necessary for proper operation of the system.
Figure 1.3 illustrates how busses might be implemented between an HC11 and some
expanded off-chip memory device. This example uses a 16-bit address bus, an 8-bit data
bus and two control signals that would be part of a larger system control bus.
Address Bus
External
HC11 Data Bus Memory
Chip Device
Read/Write Control
Output Enable
Two signals connected to the
memory device that are part
of the system control bus
5
Figure 1.3 Computer Bus Example
Technician’s Guide to the 68HC11 Microcontroller
Self-Test Questions 1.1
1. What are the three main hardware components of a computer?
2. What is the function of each of the three hardware components of a computer?
3. What connects the three hardware components and allows the data, addresses
and control signals to move between these components?
1.2 Elements of Processors
Processors have the job of processing the data within a computer and controlling the
overall operation of the system. The basic block diagram of a processor includes an
arithmetic logic unit, processor registers and a control unit, as shown in Figure 1.4.
Arithmetic Logic Unit
The arithmetic logic unit (ALU) is responsible for mathematical and logical operations.
Most processors support addition and subtraction, logical AND, OR and NOT
operations and data shifting. All of these operations are performed in an ALU. The
ALU receives data from the processor registers and from external memory via the
external data bus. It does not store data, but it returns the result of the operations to
the registers or to memory. The ALU is interfaced to a block of processor registers and
Components of the Processor
Internal Processor
Data Bus Arithmetic
Processor Logic
Registers Unit
(ALU)
Addresses Control Control
from to/from to
Registers Registers ALU
Control Unit
Address Data Control
Connection to the Devices
Outside of Processor
6
Figure 1.4 Processor Block Diagram
Introduction to Computer Hardware
to the control block, as shown in Figure 1.4. The HC11 has an ALU that can perform
operations on 8-bit and 16-bit data.
Processor Registers
The processor registers are a set of registers needed to perform the instruction
execution. The registers are used to temporarily store data and memory addresses, as
well as to contain status and control information. These registers are accessible to the
user via instructions. A basic register block configuration is shown in Figure 1.5. Each
processor will have a unique design that may not include all the registers described
here. Often a processor will contain multiple copies of these registers for versatility and
enhanced functionality.
Accumulators are special registers directly linked to the ALU to assist with the
arithmetic operations. The results of arithmetic operations are stored in an accumula-
tor. The size of the accumulators is related to the size of the data bus. If the processor
is an 8-bit processor, then it will have 8-bit accumulators. If it is a 16-bit processor, then
it will have 16-bit accumulators. Moreover, processors often have the ability to process
data of various sizes. For example, an 8-bit processor may also be able to process 16-bit
data. If the processor has a 32-bit configuration, it can also process data in 16-bit or
even 8-bit words.
The program counter is a processor register that keeps track of the address of the next
location in memory that will be accessed. Every processor must have a register that
performs the function of a program counter. The program counter is the same size as
b7 b0
8-bit Accumulator
b15 b0
16-bitAccumulator
b15 b0
Program Counter
b15 b0
StackPointer
b15 b0
AddressRegister
b7 b0
Status Register
7
Figure 1.5 Basic Processor Registers
Technician’s Guide to the 68HC11 Microcontroller
the address bus. If the processor has a 16-bit address bus, the program counter is a
16-bit register. Instructions require one or more bytes of memory for their completion;
therefore, the program counter must be capable of incrementing through memory as
the instructions are executed. Without the program counter, the processor would not
be able to determine which instruction to execute. This register is sometimes called
the instruction pointer.
The processor has a need to temporarily store and retrieve data from memory during
the processing of instructions. This temporary memory area is called the stack. The
processor must have a register that contains an address pointer that indicates the next
available memory location on the stack. This register is called the stack pointer. The
stack pointer is the same size as the address bus. If the processor has a 16-bit address
bus, the stack pointer is a 16-bit register.
Most general-purpose processors contain registers that are used specifically by the
instructions to address memory. These registers have various names, but generally they
are called address registers. The use of address registers allows for simpler instructions,
because they do not need to be concerned about the address. The address required to
complete the instruction is already provided in the address register.
Every processor must have a register dedicated to reporting status. The status register
contains bits that indicate certain results of the last operation. The most common status
bits are sign flags, carry/borrow flags, zero flags and overflow flags. The sign flags
indicate the sign of the last data processed. The carry/borrow flags indicate that an
arithmetic operation produced a result larger than could fit into the register used or
that it had to borrow to complete the operation. The zero flag indicates that result of
the last operation was zero, and the overflow flag indicates that a sign overflow occurred
(the sign of the last operation is wrong).
Control Unit
The control unit within the processor is responsible for reading the instruction from
memory; it then ensures that the instructions are executed. The control function is
driven by the instructions that are decoded by the control unit. The decoded
instruction causes a series of steps to be followed during the execution. Figure 1.6 shows
the major components of the control unit within a processor.
The memory address register (MAR) is a special address register that is linked to the
program counter. The job of the MAR is to contain the address of the current data word
that is being addressed. The memory data register (MDR) is another special register that
resides between the data bus and the various processor registers. It provides buffering
and control of the movement of data into and out of the processor. The MAR and MDR
are not accessible to the user, but are used internally by the processor for address and data
bus interface and to assist in the execution of instructions.
The instruction register (IR) is a special register that always contains the opcode for
8
the current instruction. This instruction opcode is read from memory during a fetch
Introduction to Computer Hardware
Addresses Internal Control Control
from Processor to/from to
Registers Data Bus Registers ALU
Control
Unit
IR
MAR MDR
Instruction Decoder
Address Data Control
Connection to the Devices
Outside of Processor
Figure 1.6 Components of the Processor Control Block
cycle and deposited into this register. The opcode remains in this register until it is
overwritten by the opcode for the next instruction.
Opcodes, operands and instructions are explained in Chapter 2.
NOTE: The instruction register should be called the opcode register, because it
contains only the opcode of the instruction. Operands and operand addresses
are not processed by the instruction register.
The instruction decoder is the main section of the control block. It has the job of
decoding the instruction in the instruction register and controlling the execution of
the instruction. It causes each step of the instruction execution to take place. If an
address needs to be read from memory, the instruction decoder will cause that to take
place. If data needs to be added, it will tell the ALU to perform an addition operation,
and so on.
The process of fetching and executing an instruction is covered in chapter 2.
HC11 Processor
The HC11 is a member of the Motorola 6800 family of processors. It is compatible with
9
the M6800 and M6801 processors. In addition to executing all M6800 and M6801