APE370: Microprocessor, Micro-Controller and Computer Peripherals
APE370: Microprocessor, Micro-Controller and Computer Peripherals
APE370: Microprocessor, Micro-Controller and Computer Peripherals
Micro-Controller and
Computer Peripherals
WELCOME
A.T.M. SAIFUL ISLAM
Lecturer
Department of APECE
BSMRSTU
Chapter 1:
Microprocessors
Microprocessor:
A microprocessor is a multipurpose, programmable, clock-driven, register-
based electronic device that reads binary instructions from a storage device
called memory, accept binary data as input and processes data according to
those instructions and provide results as output.
Applications:
A micro processor can be 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.
Evaluation of Microprocessors (Intel Family):
Figure 1.1: The Z3 (1930s) computer developed by Konrad Zuse uses a 5.33 hertz
clocking frequency.
Intel 4004:
Intel 8008:
Later in 1971
8-bit version of the 4004 microprocessor
16K bytes memory space
A total of 48 instructions
Intel 8080:
In 1973
8-bit microprocessors
After 6 months later Motorola Corporation introduced MC6800
microprocessor
64K bytes memory space
10 times faster than the 8008
Intel 8085:
In 1977
8-bit microprocessors
Higher speed (1.3 μs) than 8080 (2 μs)
Low cost compare to 8080
The Modern Microprocessor (8086/8088):
Arithmetic/
Logic Unit
Micro-
(ALU)
processor
As
CPU
Input Control Unit Output Input Output
Memory Memory
(a) (b)
Figure 1.2: (a) Block diagram of a computer system, (b) Block diagram of a
Computer with the Microprocessor as CPU
A computer system has four components: memory, input, output
and the central processing unit (CPU).
CPU consists of the arithmetic/logic (ALU) and control unit.
CPU contains various registers to store data temporarily.
In late 1960s CPU was designed with discrete component.
CPU on a single chip come to be known as a microprocessor.
Microprocessor is a primary component of a computer system.
A computer with a microprocessor as its CPU is known as
microcomputer.
MPU implies a complete processing unit with the necessary
control signals.
Basic Microprocessor types:
Basically two types
General Purpose and single chip microprocessors
Bit slice microprocessor
General Purpose and single chip microprocessor:
Designed in a single chip.
Typically 256 bytes of R/W memory.
1K to 8K bytes of ROM.
Several single lines to connect I/Os.
Complete microcomputers on a chip.
Also known as microcontroller.
WR
Mode DEN
select NM/MX
READY
(a) (b)
Figure 2.2: (a) Pin architecture, (b) Minimum mode block diagram, of
8086.
Vcc 5V
Power
Supply GND Ground
16 bits 88 bits
bits
Flags Register
AX CS
16 bits
AH AL IP
15 O D I T S Z A P C0
SS
BX O = Overflow
SP
BH BL D = Direction
BP I = Interrupt
CX SI T = Trace
CH CL S = Sign
DI Z = Zero
DX DS A = Auxiliary Carry
ED P = Parity
DH BL C = Carry
T1 T2 T3 T1 T2 T3 T4
Clock
Operation
Instruction
CLK
M/IO
ALE
DT/R
RD
DEN
READY
Timing diagram of Memory write machine cycle:
Instruction Memory write
T-state T1 T2 T3 T4
CLK
M/IO
ALE
DT/R
WR
DEN
READY
Stack memory:
12000.
00000
EAX
EBX FS
ECX GS
EDX
ESP
EBP
ESI
EDI
Flags register
80386
80486
EFLAGS:
RF (resume): The resume flag is used with debugging to
control the resumption of execution after the next instruction.
VM (virtual mode): VM flag bit selects virtual mode operation
in a protected mode system. A virtual mode system allows
multiple DOS memory partitions to coexist in the memory
system.
AC (alignment check): The alignment check flag bit activates if a
word or double-word is addressed on a non-word or non-double-word
boundary.
Overview of Pentium processor:
The Pentium, introduced in 1993.
64 bit microprocessor.
16K bytes cache memory.
Two introductory versions of the Pentium operated with a clocking
frequency of 60 MHz and 66 MHz.
The double-clocked Pentium, operating at 120 MHz and 133 MHz.
A dual integer processor often allows two instructions per clock.
Pentium allow full-frame video displays to operate at scan rates of
30 Hz or higher comparable to commercial television.
Pentium also employs an internal floating-point coprocessor to
handle floating-point data.
Co-processor:
A special-purpose processing unit that assists the CPU in performing certain
types of operations more quickly than the basic microprocessor circuits
could perform the same task. For example, a math coprocessor performs
mathematical computations, particularly floating point operations.
Program itself must be written to take advantage of the coprocessor.
Mostly math coprocessor, numeric coprocessor, or floating point
coprocessors are built-in.
High-end graphics, broadband signal processing and encryption/
decryption are designed as separated co-processor.
Coprocessors cannot fetch instructions from memory, execute program
flow control instructions, do I/O operations, manage memory, and so
on.
The coprocessor requires the host processor to fetch the coprocessor
instructions and handle all other operations aside from the coprocessor
functions.
Alpha processor:
Alpha, originally known as Alpha AXP, is a 64-bit reduced instruction set
computing (RISC) instruction set developed by Digital Equipment
Corporation (DEC). Alpha was implemented in microprocessors originally
developed and fabricated by DEC. These microprocessors are called alpha
processor, were most prominently used in a variety of DEC workstations
and servers.
All registers are 64 bits in length.
32 integer registers and 32 floating point registers.
31th Integer and floating point registers are used for null operations.
There are no instructions that operate directly on values stored in
memory, all data manipulation is done between registers.
In Alpha AXP the generate flags is not stored in a processor status
register, but is instead stored in a third register.
Instructions on unrelated registers do not have to wait for each other to
execute as they would if there were a single status register.
Pipeline processor:
In computers, a pipeline is the continuous and somewhat overlapped
movement of instruction to the processor or in the arithmetic steps taken
by the processor to perform an instruction.
Let us break down our microprocessor into 5 distinct activities, which
generally correspond to 5 distinct pieces of hardware:
Instruction format:
Examples:
ADD BX,CS
SUB BH, 18H
INC BL
AND BX, CS
CMP CL,BL
SHR BX,12
Program control instruction:
Used for controlling different program conditions.
Program control instruction include JMP, JZ, JNZ, JC, JNC, JCXZ,
JNP etc.
Examples:
JMP Start
JNZ Test
JC Carry
String processing:
There are five string data transfer instructions: LODS, STOS, MOVS, INS, and
OUTS.
Each string instruction allows data transfers that are either a single byte, word,
or double-word (or if repeated, a block of bytes, words, or double-words).
Examples:
MOVSB ES:[DI] = DS:[SI]; DI = DI ± 1; SI = SI ± 1
End at CX=0
Procedures
Avoid writing the same sequence of instruction again and again.
Write it in a separate subprogram and call that subprogram (By
using CALL instruction) whenever necessary.
A big advantage of using procedures is that the machine codes of
procedures needs to be loaded in to main memory only once.
Procedures slower the execution speed.
Format
procedure_name PROC
Body of procedure
RET
ENDP procedure_name
Example
Dcopy PROC
MOV AL, data1
MOV AH, data2
RET
ENDP Dcopy
Invocation
...
CALL Dcopy
...
Macro:
A macro is the group of instruction we bracket and give a name to at the start of
the program.
Using macro avoids the overhead time involved in calling and returning from a
procedures.
Disadvantage is that this will make the program take up more memory than using
a procedure.
Macros can be defined with MACRO and ENDM.
Format
macro_name MACRO [parameter1, parameter2, ...]
macro body
ENDM
Example
Axchg MACRO operand1, operand2
xchg AL,operand1
xchg AH,operand2
ENDM
Invocation
...
BX,27H
Axchg
...
Virtual memory management:
The 80286 microprocessor is an advanced version of the 8086
microprocessor that was designed for multiuser and multitasking
environments.
The 80286 addresses 16M bytes of physical memory and 1G bytes of virtual
memory by using its memory-management system.
It allows a very large system to execute in smaller physical memory systems.
Addressing a 1G-byte memory system is accomplished by the descriptors in
the 80286 microprocessor.
Each 80286 descriptor describes a 64K-byte memory segment and the 80286
allows 16K descriptors.
This (64K × 16K) allows a maximum of 1G bytes of memory to be described
for the system.
In virtual mode CS selects a descriptor that describes the starting address and
length of a section of memory holding code.
The code segment is limited to 64K bytes in the 8088–80286, and 4G bytes in
the 80386 and above.
Cache memory:
Cache memory, also called CPU memory, is random access memory that a
computer microprocessor can access more quickly than it can access regular
RAM.
As the microprocessor processes data, it looks first in the cache memory and
if it finds the data there (from a previous reading of data), it does not have to
do the more time-consuming reading of data from larger memory.
Cache memory is fast and it is expensive. It is categorized in levels that
describe its closeness and accessibility to the microprocessor.
Level 1 (L1) cache, which is extremely fast but relatively small, is located
close to the processor.
Level 2 (L2) cache is located half-way between the process and the system
bus; it is fairly fast and medium-sized.
Level 3 (L3) cache is relatively large and close to RAM.
Exception/Interrupt handler:
Chapter 6:
Computer Peripherals
HDD:
A hard disk drive (HDD) is a data
storage device used for storing and
retrieving digital information using
rapidly rotating disks (platters)
coated with magnetic material.
An HDD retains its data even
when powered off.
Data is read in a random access
manner, meaning individual blocks
of data can be stored or retrieved
in any order rather than
sequentially.
62
“DOT MATRIX PRINTER”
The term dot matrix refers to
the process of placing dots to
form an image.
Its speed is usually 30 to 550
characters per second (cps).
This is the cheapest and the
most noisy printer and has a
low print quality. Dot Matrix
were 1st introduced by
Centronics in 1970.
63
HOW DOT-MATRIX WORKS?
The dot matrix forms images one character at a time
as the print head moves across the paper.
Uses tiny pins to hit an ink ribbon and the paper
much as a typewriter does.
This printer arranges dots to form characters and all
kinds of images.
9 to 24 vertical column pins are contained in a
rectangular print head. When print head moves across
the paper, pins are activated to form a dotted
character image. These printers can produce carbon
copies along with the originals.
64
“A TYPICAL DOT MATRIX OUTPUT”
65
“ADVANTAGES/DIS-ADVATAGES
OF DOT-MATRIX”
Advantages:
(1) In-expensive.
(2) Low per page cost.
(3) Energy efficient.
Dis-advantages:
(1) Noisy
(2) Low resolution
(3) Limited fonts flexibility
(4) Poor quality graphics output.
66
“LASER PRINTER”
Laser printers use very
advanced technology and
produce a high quality
output. Laser printers can
also produce high quality
graphics images.
Resolution is 600 to
1200dpi.
67
HOW LASER PRINTER WORKS?
(1) Paper is fed and the drum rotates.
(2) A laser beam conveys information from the
computer to a rotating mirror and thus an image
is created on the drum.
(3)The charges on the drum are ionized and the
toner sticks to the drum.
(4)Toner is transferred from drum to paper.
(5)Heat is applied to fuse the toner on the paper.
68
“INK-JET PRINTER”
Itis a non-impact printer
producing a high quality
print. A standard Inkjet
printer has a resolution of
300dpi. Newer models have
further improved dpi. Inkjet
printers were introduced in
the later half of 1980s and
are very popular owing to
their extra-ordinary
performance.
69
HOW INKJET PRINTER WORKS?
(1) Print head having four ink
cartridges moves .
(2) Software instructs where to apply
dots of ink, which color and what
quantity to use.
(3) Electrical pulses are sent to the
resistors behind each nozzle.
(4) Vapor bubbles of ink are formed by
resistors and the ink is forced to the
paper through nozzles.
(5) A matrix of dots forms characters Color cartridge showing inkjet nozzles.
and pictures.
70
Digital display:
Motherboard:
Chapter 5:
Microcontrollers
Microcontroller:
An embedded microcontroller is a chip which a computer processor with
all it’s support functions (clocking and reset), memory, and i/O built into
the device.
Processor
I/O ports
Reset control
Clock and
timing RAM