1.
Introduction to the Microcomputer
A microcomputer is defined as a stand-alone system based on a
microprocessor. A stand-alone system is one that is able to
operate without additional equipment. A microprocessor is the
central processing unit (CPU) of a microcomputer constructed
within a single chip, and it is entirely useless on its own. To
make it into a viable microcomputer, it needs to be connected
to:
I. Memory to store data and programs
II. Input/Output devices to communicate with the outside world
III. Timing and control circuits
IV. A power supply
1.1 Basic Microcomputer Components
A basic microcomputer is as shown in Figure 66
Figure 1: Basic Microcomputer
Memory Unit stores the instructions that the computer is
going to perform (programs) and the data to be operated on by
the programs. The memory unit is also used to store
intermediate and final results of operations performed during
program execution. The operation of the memory is controlled
by information carried in the control bus.
Input/Output Unit contains the circuits that form an
interface between the microcomputer and the rest of the
world. For some devices, data transfer with the microcomputer
is in serial form (one bit at a time) e.g. the CRT, while for
others, data transfer is in parallel form e.g. the
microcomputer transfers information to a printer one byte at
a time. Examples of input devices include ADCs, Key- boards,
mouse, joystick e.t.c. Output devices include DACs, printers,
LED readouts, CRTs etc.
The bus system consists of the data bus, the control bus and
the address bus. These buses connect the microprocessor to
each of the memory and I/O elements so that information can be
exchanged between the microprocessor and these devices.
The Central Processing Unit (CPU)/Microprocessor
performs a large number of functions, in- cluding:
• directing the operation of all other units in the
microcomputer by providing timing and control signals for
all elements.
• fetching instructions and data from memory.
• transferring data to and from input/output devices.
• performing arithmetic and logic operations on data
• responding to input/output generated control signals such
as RESET
and INTERRUPT.
1.2The Bus System
This comprises the Address Bus, the Data Bus and the Control
Bus.
The Address bus
This is a unidirectional bus, because information flows over it
only in one direction - from the CPU to the memory or I/O
elements. It is used to specify the address of a memory location
or an I/O device involved in a data transfer.
The Data Bus
This is a bidirectional bus, since data can flow to or from the
CPU. It is used to carry data associated with a memory or I/O
transfer. During a READ operation, the CPU’s data pins act as
inputs and receive data that has been placed on the data bus
by the memory or I/O element selected by the address on the
address bus. During a WRITE operation, the CPU’s data pins
act as outputs and place data on the data bus, which is then
sent to the selected memory or I/O device.
The Control Bus
This is a set of signals that are used to synchronize the
activities of the separate microcomputer elements.
Some control signals are from the CPU to other elements to tell
them what kind of operation is in progress, e.g. READ/WRITE
signal. The I/O elements can also send control signals to the
CPU e.g. RESET signal which causes the CPU to reset to a
particular starting state, INTERRUPT REQUEST signal used by
I/O devices to get attention of the CPU when it is performing
other tasks.
5.1 Microprocessors
5.1.1 General Introduction
A microprocessor is the central processing unit (CPU) of a
microcomputer constructed within a single chip. For many years,
manufacturers identified the microprocessors with number
codes such as 4004, 8086, 68000, Z8000, etc., but of late, the
microprocessors have brand names e.g. PowerPC, Pentium,
Itanium, Xeon, etc
Microprocessors are usually classified by the number of bits the
microprocessor can process at a time. The Intel 4004 could only
manipulate 4 bits at a time hence it was referred to as a 4-bit
microproces- sor. Modern microprocessors are 32-bit or 64-bit.
Generally, a microprocessor with a large number of bits can
process instructions more quickly than one with a small word size
when both microprocessors are running at the same clock speed.
Microprocessors are made for different applications. The most
powerful microprocessors are used in servers and workstations.
Then there are microprocessors for PCs (microcomputers). At
the lower end are the microprocessors used in embedded
systems these are low-cost microprocessors, and they make
over well over 50% of all the microprocessors that are sold.
In block diagram form, a basic microprocessor can be
represented as shown in Figure 67
Figure 67: Microcomputer block diagram
The register section contains the registers that the microprocessor
uses to store temporary informa- tion. The timing and control unit
is the one that directs the operation of all the components of a
microcomputer while the Arithmetic and Logic Unit (ALU) is
the one that performs arithmetic and logic operations on data.
5.2 Programmer’s Model of a Microprocessor
The programmer sees the microcomputer as having three
characteristics:
An address space
This is a set of storage locations, each of which has an address
and contains binary coded data. The storage locations include
the computers main memory and I/O devices. The size of the
address space is defined by the number of bits the computer
uses to form an address e.g. 16-bit address bus can access 216
locations.
Registers
Registers are used to hold temporary data and control
information. Some registers have specialized functions while
others are general purpose registers.
Instruction Set
This is the set of commands which the computer can obey, out
of which machine code programs are constructed. The
instruction set includes operations that can be performed on
operand data and the addressing modes available for accessing
that operand data.
5.2.1 The Programmer’s Model of the Intel 8085
Address Space = 216 = 64K = 65536 8-bit words. Register
Set: This is shown in Figure 68
Figure 68: 8085 Register set
Register A: This is known as the accumulator. It is the register
which contains the results of all mathematical and logic
operations. Data transfers between the 8085 and input/output
devices take place through this register.
Program Counter: A 16-bit register that holds the address of
the next instruction that the micro- processor will be fetching
from memory.
Stack Pointer: Holds the 16-bit address of a special section
in memory known as the stack. It is also used to save return
address when a subroutine call is given.
B,C,D,E,H and L: These are general purpose 8-bit registers.
Some instructions allow these general purpose registers to be
grouped as register pairs so that they can hold 16-bit data
words. The pairings allowed are BC, DE and HL.
Instruction Register: Used to store the instruction that has
been fetched from memory while the decoding circuitry
determines which operation is to be performed. The instruction
register is automat- ically used by the CPU during each
instruction cycle and the programmer has no access to this
register.
Register F: The flag register. This register is a collection of
flip-flops that are used to indicate the result of an operation of
the accumulator. In general ,each instruction will affect all, some
or none of the flags.
The 8085 flag register is as shown in Figure 69
Figure 69: 8085 Flag Register
S - Sign Flag: If the most significant bit of the result of an
operation has a value of 1, this flag is set (1), otherwise it is
reset (0).
Z - Zero Flag: If the result of an operation has a value of 0,
this flag is set (1), otherwise it is reset (0).
P - Parity Flag: If the number of ones in a result is even
(even parity) this flag is set and it is reset if the result has
an odd number of ones.
CY - Carry Flag: If the instruction resulted in a carry
(from addition) or a borrow (from subtrac- tion) out of the
highest order bit, this flag is set, otherwise it is reset.
AC - Auxiliary Carry Flag: If the instruction resulted in a
carry (from addition) or a borrow (from subtraction) out of
bit 3 and into bit 4, this flag is set, otherwise it is reset.
5.2.2 The 8085 Instruction Set
The 8085 instruction set can be grouped in 5 categories:
Data Transfer Group Instructions: in this group move
data from register to register, memory to a register, or a
register to memory. Data transferred can be 8 - 16 bits in length.
An examples of such instructions is:
MOV d,s copy contents of s (source) to d (destination)
Arithmetic Group: This group includes all 8 and 16-bit
mathematical commands such as add, subtract, increment
and decrement e.g.
ADD r adds contents of register r to A, result stored in A
INCR r increment contents of register r by 1 i.e. r = r
+1
The Logical and Rotate group: Includes the logical
operators AND, OR, EXCLUSIVEOR and rotate instructions
e.g.
AND r A AND contents of register r, bit by bit, result in
A
RLC Rotate contents of accumulator left by one bit
position
The Branch Group: Also referred to as the JUMP commands.
These commands cause the control of the program to be
transferred to a new address, breaking the normal sequential
flow of a program (similar to GOTO command in BASIC). The
jump command can be conditional or unconditional e.g.
JMP addr jump to address addr - unconditional jump
JZ addr jump to addr if Zero (Z) flag is set (conditional)
JNZ addr jump to addr if Zero (Z) flag is not set
(conditional)
Stack, I/O and machine control: group Includes
instructions for maintaining the stack, reading from input
ports, setting and clearing flags.
4 Memory Devices