Professional Documents
Culture Documents
Faculty of Engineering
Department of Electrical and Electronic Engineering
Typical Applications
Microprocessors have an infinitely long list of applications. This is due to their versatility
and ease of use, factors shared by digital systems in general. The ease with which
microprocessor-based systems can be built and reconfigured makes microprocessors difficult to
live without in modern day-to-day life. Typical applications of these chips include:
Computer systems
Consumer electronics (audio and visual equipment)
Industrial control
Telecommunications
Geological data processing
Radar
Domestic/household equipment
Traffic control and regulation
Information displays
Preparatory Information
Strictly speaking, microprocessors are used to build computer systems, both small and large.
It is these systems that are put to use in applications such as those mentioned above. It is
therefore useful to provide a brief presentation of the structure of a typical computer
system, which of course incorporates a microprocessor. This helps in understanding the goal of
studying microprocessors.
Microprocessor: the central component of a computer system and it can also be referred to as
the central processing unit (CPU)
Read Only Memory (ROM): devices to store information, typically the program
Input/Output (I/O): devices used by the microprocessor to access peripherals located outside
the microprocessor such as ADCs and DACs
Data bus: this is a set of pins used to carry data into or out of the processor. Instructions
are also fetched from memory and sent to the processor via the data bus
Address bus: this is a set of pins used to indicate to both I/O devices and memory the
location being accessed by the processor. This location can point to either I/O or memory. A
memory location can be likened to a location in an array or table of values with the index in
the array being the location being accessed
Control bus: this is a set of pins used to coordinate the transfer of data between the
processor and external devices. For example, it has signals to indicate in which direction
data is being transferred (into or out of the processor). When data is being transferred into
the processor, that is called a read cycle. When data is being transferred out of the
processor, that is called a write cycle. Read and write cycles are also referred to as memory
or I/O access cycles.
Motherboard designers also have special interface buses (called expansion buses) for
peripheral devices such as graphics and sound cards, modems etc. These are made by placing so-
called interface devices or chips that give specific functionality and timing to peripherals
connected to the expansion bus. Below is a list of the most common interface buses found in
computers:
Microprocessor Classifications
Microprocessors are usually classified according to their general-purpose-register width. In
other words, the width of the internal registers of the processor determines its
classification. We therefore talk of 4bit, 8bit, 16bit, 32bit, 64bit and 128bit processors.
Naturally, the larger the processor (width), the more powerful it is meant to be. This is
generally expected since the larger the register width, the larger the data the processor can
process, making it effectively faster.
• Microprocessor: generally a single chip CPU without memory and peripherals. Examples
include processors used in PCs, Macs and workstations
• Microcontroller: generally a single chip CPU with both memory and peripherals. Examples
include processors used in consumer electronics and automatic vehicles
• Digital signal processor (DSP): generally a high performance CPU with memory,
peripherals and a specially designed ALU suitable for computationally intensive
operations. Examples include processors used in imaging equipment and Radar
Digital signal controller (DSC): generally a DSP with a more than average number of
peripherals particularly designed to simplify machine control applications. Examples are
processors used in top of the range automatic vehicles and robots
Microprocessor Families
Processors are also sometimes referred to by their so-called families. Each processor
manufacturer is known for at least one processor family. A processor family is generally a
range of processors from one manufacturer with certain characteristics that are similar. Many
of the instructions of a given processor family are generally similar, in addition to some
architectural features. A very well known family is the 80x86 architecture from Intel. It
consists of several processors including the 8086, 80286, 80386 and the Pentium. Another well-
known family is the 680x range of processors from Motorola. This includes the 6800, 6802 and
the 6809.
Processor Architectures
There are two main approaches used in designing microprocessors:
• Von Neumann architecture: the path for data is the same as that for processor
instructions. This is a rather simple and cheap approach to processor design and
implementation.
• Harvard architecture: the path for data is different from that for processor
instructions. This is a more complicated approach to processor design and
implementation although more powerful processors are obtained
Naturally, the instruction set of a processor is usually not directly used by a programmer
using high level languages such as C or Pascal, although these languages have provisions for
this. This is due to the fact that anyone using the processor’s instruction set directly must
know the internal architecture of the processor. Few people go to this depth as programs
written in high level languages are usually sufficient for most applications. It should be
noted that the compiler does the dirty job of translating high level language programs into a
program made from the processor‘s instruction set.
For system programmers and electronics professionals specialised in areas such as embedded
systems (computerized cars, TVs, etc), direct use of a processor’s instruction set is common.
This kind of coding is referred to as assembly language programming or assembler.
CISC processors have a large instruction set with instructions that can perform many complex
operations. This is advantageous to assembler programmers as coding is simplified due to a
powerful instruction set. CISC processors usually have a relatively small number of registers
RISC processors on the other hand have a smaller number of instructions that can perform
rather basic operations. In order to perform more complex operations, designers of RISC
processors rely on sophisticated compilers to make efficient use of the few available
instructions. RISC processors often have a rather large register set
The memory capacity of the processor (in bits) can thus be found by computing the product of
the number of memory locations and the width of each location in bits.
Micro-
processor
NA:2NA Memory
Address Decoder
Address Bus Cells
(located in the memory
device)
Starter kit or development board from the processor manufacturer or associate: this is a
complete computer board that incorporates a microprocessor similar to the one you intend to
use. Old boards were completely independent and did not need a PC to work. Modern development
boards use PCs as host platforms
Assembler or compiler specific to the processor used: this allows you to develop both assembly
language and high level language programs for the target board
Loader: this allows you to upload and run the programs you develop for the board
Debugger: this allows you to locate any possible errors in your programs
Generally, most of the above tools are provided by the manufacturer with any development kit
or board. Much of the associated software and examples can also be downloaded from the web.
Software development includes writing applications to run on the microprocessor. More often
than not, it may be necessary to develop a small or mini operating system to coordinate the
whole system. Such a mini operating system for a microprocessor is often referred to as a
kernel.
It should be noted that development of microprocessor based systems for applications other
than the usual computers lies in a field known as embedded systems.
• Register set: a set of registers that can be used for several operations such as
input/output and arithmetic
• Memory data register (MDR): a special bi-directional register used to temporarily hold
data to be transferred between the microprocessor and external devices
• Memory address register (MAR): a special output only register that is used to
temporarily hold (onto the address bus) the address of the memory or I/O location
currently being accessed
• Arithmetic and logic unit (ALU): the logic unit that performs arithmetic and logic
operations. Examples of operations include addition and shifting
• X, Y registers: special registers used to provide data to and get data from the ALU
• Program counter (PC) or instruction pointer (IP): this is a register that holds the
address of the memory location holding the NEXT instruction to be fetched and executed.
In other words, the PC is a pointer to the next processor instruction to be executed
• Stack pointer (SP): this is a special register that points to the top of the stack. The
stack is a small portion of RAM that is used to temporarily hold data and addresses.
The stack is used in a special way and never as a general purpose memory block. It is a
first in first out (FIFO) data structure
• Status or flags register: this is a special register that contains specially designated
bits that indicate the current status of the processor. Some of the status information
includes the effects of the last executed instruction. For example, the programmer may
subtract two numbers and choose to take on two possible actions depending on whether
the result was negative or not. The only way the processor can indicate the effect of
the last result is by setting and clearing the affected bits in the status or flags
register. It is also possible to poll the status register to determine whether an
interrupt has occurred or not
• Accumulator: this is a register designated to receive data from the ALU. Many
manufacturers choose one of the general purpose registers to be used as the accumulator
• Control unit: a complex logic circuit that coordinates the operations of all the
devices within the CPU and the peripherals connected to the microprocessor
• Internal bus: a path for data transfer within the CPU
• Cache: a small high-speed memory block used to improve overall system performance by
keeping the most frequently accessed data and instructions. This memory block is
invisible to the programmer and is directly manipulated by the internal logic of the
CPU. Some processors allow the programmer to disable the use of this cache
• Control bus signals/pins: some of the signals found on the control bus include the
following (note that signal/pin names vary according to the manufacturer):
• Read strobe: signals to connected peripherals that the processor is getting data from
the (data) bus into its internal registers
• Write strobe: signals to connected peripherals that the processor is placing data onto
the (data) bus
• Address latch enable: signals to peripherals that the address on the (address) bus is
valid in the current cycle and can be decoded by peripherals during the active duration
of the address latch enable signal
• Interrupt inputs: these can be used by peripherals to signal their need to be attended
to
• System clock: this is usually a 50% duty cycle signal that drives the processor
• Bus arbitration signals: these pins are used to negotiate a complete take over of the
system bus. In other words, (advanced) peripherals may need to drive the data, address
and control buses for reasons such as high speed data transfer between peripherals and
memory (DMA). Such devices are often referred to as bus masters
Points to note:
Generally speaking, as the MDR is directly connected to the data bus, the size of the
MDR is also the size of the data bus
Similar to i) above, as the MAR is directly connected to the address bus, the size of
the MAR is also the size of the address bus
The data bus is bidirectional due to the fact that data can move into or out of the
processor
The address bus is output only (unidirectional) due to the fact that the processor
never reads an address from peripherals per se, but instead specifies the address of
the location it wants to access
The control bus is definitely bidirectional as some of its pins are status pins,
meaning that the processor reads some status information on the control bus
For processors that support direct memory access (DMA), most of the pins can be placed
in the high impedance state to enable. In particular, the data and address buses must
be placed in high impedance so that the DMA controller or bus master can drive the
system bus
Both the segment and offset are 16bit values which therefore lead to a 20bit physical address.
It can therefore be deduced that as the offset is a 16bit value, the segment size is 216 or
64K. The following segments are usually specified for any given 8086 program:
Code segment, in which code or program instructions are located (CS register)
Data segment, in which data is either located or to be placed (DS register)
Stack segment, in which the stack is located (SS register)
Extra segment, which can be used as the programmer wishes (ES register)
As an example, a typical 8086 address is written in the format CS:IP (code segment :
Instruction pointer). Thus an address such as F000:0100 refers to the address at an offset of
0100 (hex) in segment F000 (hex). The physical address in this case would be ((F000<<4)+0100).
In case the program being developed is very small, the code, data and stack can be located in
the same segment leading to what is known as the tiny memory model. COM programs earlier used
by MSDOS are examples of programs compiled using the tiny memory model.
Closely associated with the instruction set, is the notion of addressing modes. These are the
different ways that the processor can access memory and other resources. The 8086 has the
following addressing modes:
Register addressing: the data source and destination are both registers e.g.
MOV CX, SI
MOV AL, 69
Direct addressing: the offset of the memory location to be accessed is a constant e.g.
Indirect addressing: the offset of the memory location to be accessed is indirectly given in
the BX register e.g.
MOV [BX], DX
Base addressing: the offset of the memory location to be accessed is indirectly given in the
BP register e.g.
MOV [BP], AX
Indexed addressing: the offset of the memory location to be accessed is given in any of the
index registers (SI, DI) register e.g.
MOV [SI], AX
Port addressing: this mode is reserved for I/O port access e.g.
IN AX, DX
OUT 10, AL
The 8086 datasheet lists the complete instruction set and addressing modes. It should be noted
that for all ALU operations, the result is always placed in a register, and more often in the
accumulator (AX). Consequently, for operations that require two operands (such as addition),
one of the operands must in most cases be placed in a GPR.
1. Assembler
2. Linker
3. Loader
4. Debugger
In some cases, a compiler can also be used with assembler instructions embedded in the high
level language source code. For Borland C/C++ compilers such as Turbo C/C++ and Borland C/C++,
an assembly language instruction can be added by prefixing it with the asm keyword as follows:
asm {
PUSH AX.
MOV AX, CX
SUB AX, 2
OUT DX, AX
POP AX
}
Note that the opening brace ‘{‘ must be on the same line as the asm keyword, else the compiler
will generate an error message.
-?
assemble A [address]
compare C range address
dump D [range]
enter E address [list]
fill F range list
go G [=address] [addresses]
hex H value1 value2
input I port
load L [address] [drive] [firstsector] [number]
move M range address
name N [pathname] [arglist]
output O port byte
proceed P [=address] [number]
quit Q
register R [register]
search S range list
trace T [=address] [value]
unassemble U [range]
write W [address] [drive] [firstsector] [number]
allocate expanded memory XA [#pages]
deallocate expanded memory XD [handle]
map expanded memory pages XM [Lpage] [Ppage] [handle]
display expanded memory status XS
-
Note that each debug command can be accessed by simply typing its abbreviated version. Take
the register command for example; if one enters r or R on the debug prompt (-), the utility
will display the contents of the 8086 processor (even though the utility is run on a higher
processor such as the Pentium).
More of the debug utility will be found in the lab manual. The debug utility can be exited by
entering the Q command.
O D I T S Z A P C
Bit Significance
O Overflow: previous arithmetic result couldn’t fit in accumulator
D Direction: indicates ascending/descending manipulation of strings
I Interrupt: enables/disables hardware interrupts. 1 enables interrupts
T Trap: enables the single step mode of operation. 1 enables single step
S Sign: indicates the polarity of the last result. 1 indicates a –ve result
Z Zero: indicates that the previous result was zero
A Auxiliary carry: previous BCD arithmetic operation generated a carry
P Parity: 0 indicates odd parity and 1 indicates even parity
C Carry: previous arithmetic operation generated a carry
The status register bits are used by jump (decision making) instructions in order to determine
the program flow. For an example, consider the following mini flowchart:
The program prints a different result depending on whether the result in the variable z is
negative or not. The instructions that compare z with zero and jump to different locations use
the sign (S) bit in the status register. This is set or cleared after each arithmetic/logic
instruction.
z = x + y
Yes No
Is z <
0?
Print(“-ve”); Print(“+ve”);
The pin configurations below show the signals in both modes. Note that each mode does not use
all the pins in the same way.
U1 U2 U3 U4
16 33 16 16 33 16
AD0 15 MN AD0 15 AD0 15 MN AD0 15
22 AD1 14 22 AD1 14 22 AD1 14 22 AD1 14
19 READY AD2 13 19 READY AD2 13 19 READY AD2 13 19 READY AD2 13
21 CLK AD3 12 21 CLK AD3 12 21 CLK AD3 12 21 CLK AD3 12
RESET AD4 11 RESET AD4 11 RESET AD4 11 RESET AD4 11
18 AD5 10 18 AD5 10 18 AD5 10 18 AD5 10
INTR AD6 9 INTR AD6 9 INTR AD6 9 INTR AD6 9
AD7 8 AD7 8 AD7 8 AD7 8
AD8 7 AD8 7 A8 7 A8 7
AD9 6 AD9 6 A9 6 A9 6
AD10 5 AD10 5 A10 5 A10 5
AD11 4 AD11 4 A11 4 A11 4
AD12 3 AD12 3 A12 3 A12 3
AD13 2 AD13 2 A13 2 A13 2
AD14 39 AD14 39 A14 39 A14 39
AD15 38 AD15 38 A15 38 A15 38
A16/S3 37 A16/S3 37 A16/S3 37 A16/S3 37
A17/S4 36 A17/S4 36 A17/S4 36 A17/S4 36
A18/S5 35 A18/S5 35 A18/S5 35 A18/S5 35
A19/S6 A19/S6 A19/S6 A19/S6
34 34 34 34
BHE/S7 BHE/S7 BHE SSO
26 26 26 26
S0 27 DEN 27 S0 27 DEN 27
S1 28 DT/R 28 S1 28 DT/R 28
31 S2 30 M/IO 31 S2 30 IO/M
30 RQ/GT0 32 31 HLDA 32 30 RQ/GT0 32 31 HLDA 32
17 RQ/GT1 RD 29 17 HOLD RD 29 17 RQ/GT1 RD 29 17 HOLD RD 29
23 NMI LOCK 25 23 NMI WR 25 23 NMI LOCK 25 23 NMI WR 25
33 TEST QS0 24 TEST ALE 24 33 TEST QS0 24 TEST ALE 24
MX QS1 INTA MX QS1 INTA
Minimum mode
In minimum mode, the processor generates all the required signals to drive the control signals
of the system bus. In particular, pins 24 to 31 are used as control signals.
Maximum mode
In maximum mode, the processor relies on a bus control chip such as the 8288 to drive the
control signals of the system bus. Pins 24 to 31 then take on a role different from that in
minimum mode. Most of these signals are decoded by the (8288) bus controller in order to drive
the system bus in a so-called maximum performance system. Such a system can involve more than
one microprocessor and possibly several DMA-capable peripherals.