0% found this document useful (0 votes)
4 views

Microprocessor Slides

The document provides an overview of microprocessors, detailing their functions, components, and the architecture of microprocessor-based systems. It explains the roles of various units such as the Input Unit, Memory Unit, Arithmetic and Logical Unit, Control Unit, and Output Unit, as well as the significance of buses in communication between components. Additionally, it covers the Intel 8080 microprocessor, its features, instruction set, and the distinction between low-level and high-level programming languages.

Uploaded by

peheyod776
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

Microprocessor Slides

The document provides an overview of microprocessors, detailing their functions, components, and the architecture of microprocessor-based systems. It explains the roles of various units such as the Input Unit, Memory Unit, Arithmetic and Logical Unit, Control Unit, and Output Unit, as well as the significance of buses in communication between components. Additionally, it covers the Intel 8080 microprocessor, its features, instruction set, and the distinction between low-level and high-level programming languages.

Uploaded by

peheyod776
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 46

INFORMATION AND COMMUNICATIONS UNIVERSITY

SCHOOL OF ENGINEERING
Electronics for Computing 3

Lecturer : M Shabiyemba
Email: [email protected]
Cell: 0969796822
Introduction
• Microprocessor is a digital device on a chip which can fetch
instructions from a memory, decode and execute them i.e. performs
certain arithmetic and logical operations,
accept data from input device, and send results to output devices.
• Therefore, a microprocessor interfaced with memory and Input/
Output devices forms a Microcomputer. Basically, there are five
building blocks of a digital computer namely,
Input Unit
• Through this unit data and instructions are fed to the memory of the
• computer. The basic purpose of this unit is to read the data into the
• machine. The program from the memory is read into the machine
• along with the input data which are required to solve or compute the
• problem by the machine. The typical devices which are used for this
• purpose are keyboards, paper tape reader and toggle switches etc.
Memory Unit
• The memory unit of a digital computer consists of devices which are
• capable of storing information. The memory of a computer is used
• for storing two distinct type of information such as data to be
• processed by the computer and program through which the result of
• the desired problem is obtained. Computer program and data are
• stored in the Memory Unit. This usually consists of chips of both
• ROMs (Read Only Memories) and RAMs (Random Access
• Memories) either bipolar or MOS.
Arithmetic and Logical Unit
• This unit is used for performing arithmetic operations such as
• Addition, Subtraction, Multiplications, division and other logical
• (ALU) operations on the data.
• The control unit guides ALU which of the operations are to be
• performed. The sequence of the instructions is controlled by the
• control unit.
Control Unit
• The control unit performs the most important function in a computer.
• It controls all other units and also controls the flow of data from one
• unit to another for performing computations. It also sequences the
• operations. It instructs all the units to perform the task in a particular
• sequence with the help of clock pulses.
Output Unit
• After processing of the data in the Arithmetic and Logical Unit, the
• results are displayed to the output world through this unit. The CRTs
• (Cathode Ray Tubes), LEDs (Light Emitting Diodes) and Printer etc.
• form the output unit.
• In a computer system ALU and Control Unit are combined in one unit
called
• Central Processing Unit (CPU).
The block diagram of a computer is shown in figure 1.1
Cont’d
• The Central Processing Unit is analogous to the human brain as all the
decisions as per the instructions are made by CPU. All other parts are also
controlled by this unit.

• A microprocessor is an integrated circuit designed for use as Central


Processing Unit of a computer. The CPU is the primary and central player in
communicating with devices such as memory, input and output.

• However, the timing of communication process is controlled by the group of


circuits called control unit.
Cont’d
• . A microprocessor is a programmable digital electronic component
that incorporates the functions of a Central Processing Unit (CPU) on
single semi-conducting Integrated Circuits (ICs).
• As such, a system with microprocessor as an integral part is termed
as a microprocessor based system. When a computer is
microprocessor based, it is called a microcomputer (µ c).
Cont’d
• A microprocessor is specified by its ‘Word Size’, e.g. 4-bit, 8-bit, 16-bit etc. By
the term ‘word size” means the number of bits of data that is processed by
the as a unit. For example, an 8-bit microprocessor performs various on 8-bit
data.
• It also specifies the width of the data bus. A microcomputer consists of
input/ output devices, and memory, in addition to which acts its CPU. In fact
CPU is commonly referred to microprocessor (µ p). Microprocessors made
possible the advent of the microcomputer in the mid-1970s.
• Before this period, electronic CPUs were typically made from bulky discrete
switching devices. Later on small-scale integrated circuits were used to
design the CPUs. By integrating the processor onto one or very few large-
scale integrated circuit package (containing the equivalent of thousands or
millions of discrete transistors), the cost of processor was greatly reduced.
Cont’d
• The microprocessor based systems play significant role in the every
functioning of industrialized societies. The microprocessor can be
viewed as a programmable logic device that can be used to control
processes or to turn on/off devices.
• So the microprocessor can be viewed as a data processing unit or a
computing unit of a computer. 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.
Cont’d
• Nowadays, the microprocessor is being used in a wide range of
products called microprocessor based products or systems. The
microprocessor communicates and operates in the binary numbers 0
and 1, called bits.
• microprocessor has a fixed set4 of instructions in the form of binary
pattern called a machine language. However, it is difficult for human
beings to communicate in the language of 0s and 1s.
• Therefore, the binary instructions are given abbreviated names, called
mnemonics, which form the assembly language for a given
microprocessor
BASIC MICROPROCESSOR SYSTEM
• The Microprocessor alone does not serve any useful purpose unless it
is supported by memory and I/O ports. The combination of memory
and I/O ports with microprocessor is known as microprocessor based
system.
• microprocessor which is the central processing unit executes the
program stored in the memory and transfer data to and from the
outside world through I/O ports. The microprocessor is
interconnected with memory and I/O ports by the data bus, the
Address bus and the control bus.
• A bus is basically a communication link between the processing unit
and the peripheral devices as shown in figure 1.2.
Address Bus
• The address bus is unidirectional and is to be used by the CPU to send
out address of the memory location to be accessed. It is also used by
the CPU to select a particular input or output port. It may consist of 8,
12, 16, 20 or even more number of parallel lines.
• Number of bits in the address bus determines the minimum number
of bytes of data in the memory that can be accessed. A 16-bit address
bus for instance can access 216 bytes of data. It is labeled as
A0…………An-1, where n is the width of bits of the address bus.
Bus System
Data Bus

• Data bus is bidirectional, that is, data flow occurs both to and from CPU
and peripherals. There is an internal data bus which may not be of the
same width as the external data bus by that connects the I/O and
memory. A microprocessor is characterized by the width of its data bus.
• All those microprocessors having internal and external data buses of
different widths are characterized either by their internal or external
data buses.
• The size of the internal data bus determines the largest number that
can be processed by a microprocessor, for instance, having a 16-bit
internal data bus is 65536 (64K). The bus is labeled as:
• D0 ………………Dn-1, where n is the data bus width in bits
Control Bus
• Control bus contains a number of individual lines carrying
synchronizing signals. The control bus sends out control signal to
memory, I/O ports and other peripheral devices to ensure proper
operation. It carries control signals like MEMORY READ, MEMORY
WRITE, READ INPUT PORT, WRITE OUTPUT PORT, HOLD, INTERRUPT
etc.
• For instance, if it is desired to read the contents of a particular
memory location, the CPU first sends out address of that very location
on the address bus and a ‘Memory Read’ control signal on the control
bus. The memory responds by outputting data stored in the
addressed memory location on the data bus
Cont’d
• We will confine the detailed study of 8085 microprocessor because it
is most commonly used microprocessor. However, evolution of
microprocessors has been discussed in order to have the knowledge
microprocessors introduced so far.
BRIEF DESCRIPTION OF 8-BIT MICROPROCESSOR 8080A

• Intel 8080 microprocessor is a successor to the Intel 8008 CPU. The


Intel 8080/8080A was not object-code compatible with the 8008, but
it was source-code compatible with it. The 8080 CPU had the same
interrupt processing logic as the 8008, which made porting of old
applications easier.
• Maximum memory size on the Intel 8080 was increased from 16 KB to
64 KB. The number of I/O ports was increased to 256. In addition to
all 8008 instructions and addressing modes the 8080 processor
included many new instructions and direct addressing mode. The
8080 also included new Stack Pointer (SP) register.
Cont’d
• The SP was used to specify position of external stack in CPU memory, and
the stack could grow as large as the size of memory. Thus, the CPU was
no longer limited to 7-level internal stack, like the 8008 did. The Intel
8080, an 8-bit microprocessor was very popular.
• Its salient features include:
a) A two-phase clock input Q1 and Q2
b) 16-bit address bus
c) 8-bit data bus
d) Power supply input of +5V, -5V and +12V required.
• The 8080A places the status of the operation on the data bus during the
earlier part of the cycle and places data on the bus during later part of
cycle.
Cont’d
program memory
• program can be located anywhere in memory. Jump, branch and call
instructions use 16-bit addresses, i.e. they can be used to jump/branch
anywhere within 64 KB. All jump/branch instructions use absolute addressing.
Data memory
• The processor always uses 16-bit addresses so that data can be placed
anywhere.
Stack memory
• It is limited only by the size of memory. Stack grows downward. 11 Interrupts
The processor supports maskable interrupts. When an interrupt occurs the
processor fetches from the bus one instruction, usually one of these
instructions:
Cont’d
One of the 8 RST instructions (RST0 - RST7). The processor saves current
program counter into stack and branches to memory location N * 8
(where N is a 3-bit number from 0 to 7 supplied with the RST instruction).
• CALL instruction (3 byte instruction). The processor calls the subroutine,
address of which is specified in the second and third bytes of the
instruction.
• The interrupt can be enabled or disabled using EI (Enable Interrupts)
and DI (Disable Interrupts) instructions.
• I/O ports
• 256 Input ports
• 256 Output ports
Registers

• Accumulator or A register is an 8-bit register used for arithmetic,


logic, I/O and load/store operations. Flag is an 8-bit register contains
the following five, 1-bit flags:
• Sign flag - set if the most significant bit of the result is set.
• Zero - set if the result is zero.
• Auxiliary carry flag - set if there was a carry out from bit 3 to bit 4 of
the result.
• Parity flag - set if the parity (the number of set bits in the result) is
even.
• Carry flag - set if there was a carry during addition, or borrow during
subtraction/comparison.
General registers:

• 8-bit B and 8-bit C registers can be used as one 16-bit BC register pair.
When used as a pair the C register contains low-order byte. Some
instructions may use BC register as a data pointer.
• 8-bit D and 8-bit E registers can be used as one 16-bit DE register pair.
When used as a pair the E register contains low-order byte. Some
instructions may use DE register as a data pointer.
Cont’d
• 8-bit H and 8-bit L registers can be used as one 16-bit HL register pair.
When used as a pair the L register contains low-order byte. HL
register usually contains a data pointer used to reference memory
addresses.
• Stack pointer It is a 16 bit register. This register is always
incremented/decremented by 2. Program counter It is also a 16-bit
register.
Instruction Set

• 8080 instruction set consists of the following instructions:


• Data moving instructions.
• Arithmetic - add, subtract, increment and decrement.
• Logic - AND, OR, XOR and rotate.
• Control transfer – conditional, unconditional, call subroutine, return
from
• subroutine and restarts.
• Input/Output instructions.
• Other – setting/clearing flag bits, enabling/disabling interrupts, stack
operations, etc
COMPUTER PROGRAMMING LANGUAGES

• In order for computers to accept commands from human and perform tasks
vital to productivity, a means of communication must exist. Programming
languages provide this necessary link between man and machine. Because
they are quite simple compared to human language, rarely containing more
than few hundred distinct words, programming languages must contain very
specific instructions. There are more than 2,000 different programming
languages in existence, although most programs are written in one of several
popular languages, like BASIC, COBOL, C++, or Java.
• Programming languages have different strengths and weaknesses. Depending
on the kind of program being written, the computer will run on the experience
of the programmer, and the way in which the program will be used, the
suitability of one programming language over another will vary. One can
categorize computer language as low Level and high level programming
languages which are being discussed in the subsequent subsections.
Low-Level Programming Language

• A low-level programming language is a language that provides little or no


abstraction from a computer's instruction set architecture. The word "low"
refers to the small or nonexistent amount of abstraction between the
language and machine language; because of this, low-level languages are
sometimes described as being "close to the13 hardware." A low-level
language does not need a compiler or interpreter to run;
• the processor for which the language was written is able to run the code
without using either of these. By comparison, a high-level programming
language isolates the execution semantics of computer architecture from
the specification of the program, making the process of developing a
program simpler and more understandable. Low-level programming
languages are sometimes divided into two categories:
• first generation, and second generation programming languages.
First Generation Programming Language

• The First-Generation Programming Language (1GL) is machine code or machine


• language. Machine language is a language which is directly understood by a computer. It
• is also called binary language as it is based on 0s or 1s. Any instruction in machine
• language is represented in terms of 0’s and 1’s, even the memory addresses are given in
• binary mode. Programs in machine language are very difficult to read and understand as
• binary codes of each command can not easily be remembered. So it is very difficult and
• complicated to write the computer program in machine language. The experienced
• programmer can only work in machine language that too after having the good
• knowledge of machine hardware. Programs written in machine language cannot easily be
• understood by other programmers. Currently, programmers almost never write programs
• directly in machine code, because as discussed above it not only require attention to
• numerous details which a high-level language would handle automatically, but it also
• requires memorizing or looking up numerical codes for every instruction that is used.
Second Generation Programming Language

• The Second-Generation Programming Language (2GL) is assembly language.


• Assembly language was first developed in the 1950s and it is different for different
• microprocessors. It was the first step to improve the computer programming. For writing
• the programs in assembly language it is necessary that the programmers should have the
• knowledge of machine hardware. The assembly language eliminated much of the
errorprone and time-consuming first-generation programming needed with the earliest
• computers, freeing the programmer from tedious or boring jobs such as remembering
• numeric codes and calculating memory addresses. The assembly language was once
• widely used for all sorts of programming. However, by the 1980s (1990s on small
• computers), the use of assembly languages had largely been supplanted by high-level
• languages, in the search for improved programming productivity.
• Assembly languages are basically a family of low-level languages for
• programming computers, microprocessors, microcontrollers etc. They implement a
• symbolic representation of the numeric machine codes and other constants needed to
• program a particular CPU architecture. This representation is usually defined by the
• hardware manufacturer, and is based on abbreviations (called mnemonics) that help the14
• programmer remember individual instructions, registers, etc. An assembly language is
• thus specific to certain physical or virtual computer architecture. Instructions (statements)
• in assembly language are generally very simple, unlike those in high-level languages.
• Generally, an opcode is a symbolic name for a single executable machine language
• instruction, and there is at least one opcode mnemonic defined for each machine language
• instruction.
Cont’d
• Each instruction typically consists of an operation or opcode plus zero or
• more operands. Most instructions refer to a single value, or a pair of values.
Operands
• can either be immediate (typically one byte values, coded in the instruction
itself) or the
• addresses of data located elsewhere in storage.
• A typical assembly language statement of 8080A or 8085 microprocessor
written
• by the programmer is given below, which is divided in to four fields namely,
Label,
• Mnemonics or Operation code (Opcode), Operand and comments.
• Label Mnemonics Operand Commnets
• START: LXI H, 2500 H ; Initialize H-L register pair
• A label for an instruction is optional, but it is very essential for specifying jump
• locations. Similarly, comments are also optional but it is required for good
• documentation. The four fields of assembly language statements shown above are
• separated by the following delimiters:
• Delimiters Placement
• Colon (:) A colon is placed after the Label. Label is optional.
• Space ( ) Space is left between an opcode and operand.
• Comma (,) A comma is placed between two operands.
• Semicolon (;) Semicolon is placed between the comments.
• The program written in assembly language is converted to machine language
• manually. For writing the program in machine language, the starting address, where the
• nguage.
• program is to be stored should be known. Now the op code of the instruction is to be
• written in first location (starting address) and in the consecutive memory locations data
• /address of the operand is written. While storing the address in the memory locations,
• lower byte of he address is stored first then the upper byte.
• A utility program called an assembler is used to translate assembly language
• statements into the target computer's machine code. The assembler performs a more or
• less isomorphic translation (a one-to-one mapping) from mnemonic statements into
• machine instructions and data. The reverse process that is conversion of machine
• language to the assembly language is done by deassembler.15
• For software development for a microprocessor/ microcomputer (written in
• assembly language in large number of instructions), it is absolutely essential to use an
• assembler. In fact assembler translates mnemonics into binary code with speed and
• accuracy; thus eliminating human error in looking for the opcodes. Other advantages of
• using the assembler for the software development are as follows:
• • It assigns appropriate values to the symbols used in a program. This
• facilitates specifying jump locations.
• • The assembler checks syntax errors, such as wrong labels and expressions,
• and provides error messages. However it cannot check logic errors in a
• program.
• • It is easy to insert or delete instructions in a program; the assembler can
• reassemble the entire program quickly with new memory locations and
• modified addresses fro jump locations. This avoids rewriting the program
• manually.
High-Level Programming Language

• The machine language and assembly languages discussed above are the first and
• second generation programming languages which fall in the category of low level
• languages. These languages require deep knowledge of computer hardware. The high
• level computer languages developed around 1960s are machine independent i.e.
computer
• hardware is not necessary to know for the programmers. In high level languages one has
• to know only the instructions in English word and logic of the problem irrespective of the
• types of computer being used. For the computer programming prepared in high level
• language, only the use of English alphabets and mathematical systems like +, -, /, * etc.
• are made. In fact high level language is more close to user and is easy to read and
• understand. The high level languages are called procedural language and are designed to
• solve general and specific problems.
Cont’d
• The term "high-level language" does not imply that the language is superior to
• low-level programming languages - in fact high level refers to the higher level of
• abstraction from machine language. They have no opcodes that can directly compile the
• language into machine code, unlike low-level assembly language.
• In high level languages the words in English are converted into binary language
• of different microprocessors with the help of a program called Interpreter or Complier.
• The compiler or interpreter accepts English like statements as the input called Source
• code. The source codes are translated into machine language compatible with the
• microprocessor being used in the machine. The translation in the machine language from
• the source code is called the object code. Figure 1.4 shows the block diagram for
• translation of high level language program into machine code. Each microprocessor
• needs its own compiler or an interpreter for each high level la
Cont’d
• The difference between a compiler and an interpreter is that the compiler
reads
• the entire program first and then generates the object code; where as the
interpreter reads
• one instruction at a time and produces its object code which is executed at
the same time
• before reading the next instruction. The high level programming language
developed so
• far may be categorized into third, fourth and fifth generation programming
languages
• whose brief discussion is given below.
Third Generation Programming Language

• A third-generation programming language (3GL) is a refinement of a secondgeneration programming


language. Whereas a second generation language is more aimed
• to fix logical structure to the language, a third generation language aims to refine the
• usability of the language in such a way to make it more user friendly. A third generation
• language improves over a second generation language by having more refinement on the
• usability of the language itself from the perspective of the user.
• Languages like ALGOL, COBOL, FORTRAN IV etc. are examples of this
• generation and were considered as high level languages. Most of these languages had
• compilers and the advantage of this was speed. Independence was another factor as these
• languages were machine independent and could run on different machines. FORTRAN
• (FORmula TRANslating) and COBOL (COmputer Business Oriented Language) were
• the first high-level programming languages to make an impact on the field of computer
• science. Along with assembly language, these two high-level languages have influenced
• the development of many modern programming languages, including Java, C++, and
BASIC.
• FORTRAN is well suited for math, science, and engineering programs because of
• its ability to perform numeric computations. The language was developed in New York
• by IBM's John Backus. FORTRAN was known as user’s friendly, because it was easy to
• learn in a short period of time and required no previous computer knowledge. It
• eliminated the need for engineers, scientists, and other users to rely on assembly
• programmers in order to communicate with computers. Although FORTRAN is often
• referred to as a language of the past, computer science students were still taught the
• language in the early 2000s for historical reasons, and because FORTRAN code still
• exists in some applications.17
• COBOL was another high level and third generation programming language well
• suited for creating business applications. COBOL's strength is in processing data, and in
• its simplicity.
• Other languages like BASIC, C, C++, C#, Pascal, and Java are also thirdgeneration languages.
• Fourth-Generation Programming Language
Third Generation Programming Language

• A third-generation programming language (3GL) is a refinement of a secondgeneration programming


language. Whereas a second generation language is more aimed
• to fix logical structure to the language, a third generation language aims to refine the
• usability of the language in such a way to make it more user friendly. A third generation
• language improves over a second generation language by having more refinement on the
• usability of the language itself from the perspective of the user.
• Languages like ALGOL, COBOL, FORTRAN IV etc. are examples of this
• generation and were considered as high level languages. Most of these languages had
• compilers and the advantage of this was speed. Independence was another factor as these
• languages were machine independent and could run on different machines. FORTRAN
• (FORmula TRANslating) and COBOL (COmputer Business Oriented Language) were
• the first high-level programming languages to make an impact on the field of computer
• science. Along with assembly language, these two high-level languages have influenced
• the development of many modern programming languages, including Java, C++, and
• BASIC.
Cont’d
• FORTRAN is well suited for math, science, and engineering programs because of
• its ability to perform numeric computations. The language was developed in New York
• by IBM's John Backus. FORTRAN was known as user’s friendly, because it was easy to
• learn in a short period of time and required no previous computer knowledge. It
• eliminated the need for engineers, scientists, and other users to rely on assembly
• programmers in order to communicate with computers. Although FORTRAN is often
• referred to as a language of the past, computer science students were still taught the
• language in the early 2000s for historical reasons, and because FORTRAN code still
• exists in some applications.17
• COBOL was another high level and third generation programming language well
• suited for creating business applications. COBOL's strength is in processing data, and in
• its simplicity.
• Other languages like BASIC, C, C++, C#, Pascal, and Java are also thirdgeneration languages.
Fourth-Generation Programming Language

• A fourth-generation programming languages (4GL) (1970s-1990) are the


• programming language designed with a specific purpose in mind, such as the
• development of commercial business software. In the evolution of computing, the fourth
• generation language followed the third generation language in an upward trend toward
• higher abstraction and statement power. The fourth generation language was followed by
• efforts to define and use a fifth generation language (5GL). Basically the fourth
• generation languages are languages that consist of statements similar to statements in a
• human language. Fourth generation languages are commonly used in database
• programming and scripts. The commonly used fourth generation languages are FoxPro ,
• SQL , MATLAB etc.
Fifth-Generation Programming
Language
• A fifth-generation programming language (5GL) is a programming language
• based around solving problems using constraints given to the program, rather than using
• an algorithm written by a programmer. Most constraint-based and logic programming
• languages and some declarative languages are fifth-generation languages.
• While fourth-generation programming languages are designed to build specific
• programs, fifth-generation languages are designed to make the computer solve a given
• problem without the programmer. This way, the programmer only needs to worry about
• what problems need to be solved and what conditions need to be met, without worrying
• about how to implement a routine or algorithm to solve them. Fifth-generation languages
• are used mainly in artificial intelligence research. Prolog, OPS5, Visual Basic, and
• Mercury etc. are examples of fifth-generation languages.

You might also like