Lecturenote 760844058chapter One
Lecturenote 760844058chapter One
AN OVERVIEW OF MICROPROCESSORS
AND ASSEMBLY LANGUAGE
PROGRAMMING.
Chapter One
Learning Outcomes
At the end of the course, student should be:
a) Able to understand the basic operation of
microprocessor.
b) Able to understand the basic concept of
microprocessor architecture and its pins
configuration.
c) Able to understand the machine language
programs.
d) Able to design and write programs in assembly
language.
e) Able to understand the basic concept of
microprocessor input/output interfacing
What is Microprocessor?
The term ‘micro’ means extremely small and
‘processor’ means the thing that accelerates tasks.
So in general sense the term ‘microprocessor’ means
an extremely small thing that can accelerate different
tasks as ordered. But the actual definition of
microprocessor is slightly different than this.
A microprocessor is a tiny electronic chip containing
transistors found inside a computer’s central
processing unit and other electronic devices. Its basic
function is to take input, process it and then provide
appropriate output.
The microprocessor is a general-purpose
programmable logic device.
Understanding the microprocessor concepts is crucial
in understanding the operation of digital computer.
The content of the course is divided into three
sections:
–microprocessor architecture,
–programming and
–interfacing input/output.
The microprocessor itself is usually a single integrated
circuit (IC).
Most microprocessors (MPU), or very small computers,
have much the same commands or instructions that
they can perform.
–They vary mostly in the names used to describe each
command.
In a typical MPU, there are commands to move data
around, do simple math (add, subtract, multiply, and
divide), bring data into the micro from the outside world,
and send data out of the micro to the outside world.
The microprocessor is a programmable integrated device that has
computing and decision-making capability similar to that of the
central processing unit (CPU) of a computer.
The fact that the microprocessor is programmable means it can
be instructed to perform given tasks within its capability.
The microprocessor is a clock-driven semiconductor device
consisting of electronic logic circuits manufactured by using either
a large-scale integration (LSI) or very-large-scale integration (VLSI)
technique.
A typical MPU has three basic parts inside. They are:
–the Program Counter (PC)
–Memory, and
–Input / Output (I/O).
The Program Counter keeps track of which command is to be
executed.
The Memory contains the commands to be executed.
The Input / Output handles the transfer of data to and from the
outside world (outside the MPU physical package).
There are many other actual parts inside the MPU,
Nowadays, the microprocessor is being used in a
wide range of products called microprocessor-based
products or systems.
The microprocessor can he embedded in a larger
system, can be a stand alone unit controlling
processes, or it can function as the CPU of a computer
called a microcomputer.
The microprocessor communicates and operates in
the binary numbers 0 and 1, called bits.
Each microprocessor has a fixed set of instructions in
the form of binary patterns called a machine language.
It is difficult for humans to communicate in the
language of 0 s and 1 s.
Therefore, the binary instructions are given
abbreviated names, called mnenomics, which form the
assembly language for a given microprocessor.
A typical programmable machine can be represented with
four components: microprocessor, memory, input, and
output.
These four components work together or interact with each other
to perform a given task; thus, they comprise a system.
The physical components of this system are called hardware.
A set of instructions written for the microprocessor to perform a
task is called a program, and a group of programs is called
software.
The microprocessor applications are classified primarily in
two categories:
–reprogrammable systems and
–embedded systems.
In reprogrammable systems, such as microcomputers, the
microprocessor is used for computing and data processing. These
systems include:
–general-purpose microprocessors capable of handling large data,
mass storage devices (such as disks and CD-ROMs), and
peripherals such as printers; –a personal computer (PC) is a typical
illustration.
In embedded systems, the microprocessor is a part of a final
product and is not available for reprogramming to the end user.
Example:
–copying machine
–washing machine.
–Air-conditioner
–Etc.
Microprocessor, CPU & Microcontroller
Microprocessor (MPU) -a semiconductor device (integrated
circuit) manufactured by using the LSI technique.
It includes the ALU, register arrays, and control circuits on a
single chip.
CPU -the central processing unit.
–The group of circuits that processes data and provides control
signals and timing. It includes the arithmetic/logic unit,
registers, instruction decoder, and the control unit.
Microcontroller -a device that includes microprocessor,
memory, and I/O signal lines on a single chip, fabricated using
VLSI technology.
In large computers, a CPU implemented on one or
more circuit boards performs these computing
functions.
The microprocessor is in many ways similar to the
CPU, but includes all the logic circuitry, including the
control unit, on one chip.
• Four general purpose registers (AX, BX, CX, DX) are made of
two separate 8 bit registers, for example if AX=
0011000000111001, then AH=00110000 and AL=00111001.
Therefore, when you modify any of the 8 bit registers 16 bit
register is also updated, and vice-versa. The same is for other
three registers, "H" is for high and "L" is for low part.
Compiled by Yonas A. and Hailemari 42
am M. [2010]
Compiled by Yonas A. and Hailemari 43
am M. [2010]
Segment Registers
• CS (Code Segment)
– Points at the segment containing the current
program
• DS (Data Segment)
– Generally points at segment where variables are
defined.
• SS (Stack Segment)
– Points at the segment containing the stack
• ES (Extra Segment)
Special purpose registers
– Extra segment register, it's up to a coder to define its
IP - the instruction pointer
usage.
register always works together with CS segment register and it
points to currently executing instruction.
Flags Register - determines the current state of the processor.
is modified automatically by CPU after mathematical
operations, this allows to determine the type of the result, and
to determine conditions to transfer control to other parts of the
44
program.
14 types of Registers
• AX - the accumulator register input/output
operations a, ax, eax, rax.
• BX - the base address register Holds address of
data b, bx, ebx, rbx..
• CX - the count register counts used in loop cx,
ecx, rcx
• DX - the data register holds data for output d,
dx, edx, rdx.
• SI - source index register points the source
operand
• DI - destination index register points the
destination operand
• BP - base pointer base of the top of the stack
• SP - stack pointer points current top of stack.
• CS (Code Segment) holds address of code
segment
• DS (Data Segment) holds address of data
segment
45
• SS (Stack Segment) holds address of stack
I/O Interfaces
• I/O devices such as keyboards and displays
establish communication of computer with outside
world.
• Devices can be interfaced in two ways
– I/O mapped I/O and
– Memory mapped I/O.
• In I/O mapped I/O, device is identified with a unique
device number and data are transferred thru IN/OUT
instruction.
• Memory mapped I/O each device is identified with
16 bit address. I/O devices are considered to be a
part of memory and memory related instruction is
used for data transfer.
• An I/O interface must be able to
– Determine whether or not it is being interfaced
– Determine whether it has to send data to CPU or
receive data from CPU 46
•
interface
An Interface can be divided into two parts.
– A part that interfaces to the I/O device and
– A part that interfaces to the system bus.
• There must be drivers and receivers to maintain
– signal quality,
– logic for translating the interface control signals
to proper handshaking signals,
– logic for decoding address that appear on the
bus.
• Handshaking signals are used to determine in
which direction transfer has to take place whether
from CPU or to CPU.
– It should determine whether it is a READ or
WRITE operation. Interrupt signals also must be
handled here.
• Address decoder determine whether it is I/O
mapped I/O or Memory
Compiled bymapped I/O from one of the47
Yonas A. and Hailemari
am M. [2010]
Memory Mapped