You are on page 1of 29

CourseCode:20EC0416

R20
UNIT –1
MICROPROCESSORS, MICROCOMPUTER AND ASSEMBLY LANGUAGE
1. Draw a block diagram of Microprocessor based system and explain the functions of each
component: Microprocessor, Memory and I/O and their line communication [L4] [CO1]
[12M]
The basic components of Microprocessor based system are
Arithmetic and Logic Unit

In this area of the microprocessor, computing functions are performed on data. The CPU performs
arithmetic operations such as addition and subtraction, and logic operations such as AND, OR, and
exclusive OR. Results are stored either in register or in memory or sent to output devices.
Register Unit
This area of the microprocessor consists of various registers. The register are used primarily to
store data temporarily during the executing of a program. Some of the registers are accessible to
the user through instructions.

Control Unit
The control unit provides the necessary timing and control signals to all the operations in the
microcomputer. It controls the flow of data between the microprocessor and peripherals

Block diagram of Microprocessor based system


Input
The input section transfers data and instructions in binary from the outside world to the
microprocessor. It includes devices such as keyboards, teletypes, and analog-to-digital converters.
Output
The output section transfers data from the microprocessor to output devices such as light emitting diodes

(LEDs), cathode-ray-tubes (CRTs), printers, magnetic tape, or another computer. Typically,

single-board computers include LEDs and seven-segment LEDs as output devices.


Memory
Memory stores binary information such as instructions and data, and provides that information to
the microprocessor whenever necessary. To execute programs, the microprocessor reads
instructions and data from memory and performs the computing operations in its ALU section.

The memory block has two sections Read - Only


Memory (ROM) Random Access Memory (RAM)
System Bus
The system bus is a communication path between the microprocessor and the peripherals; it is
nothing but a group of wires that carries bits. The microcomputer bus is in many ways similar to a
one-track, express subway, the microcomputer bus carries bits between the microprocessor and
only one peripheral at a time. The same bus is time - shared to communicate with various
peripherals, with the timing provided by the control section of the Microprocessor.

2.a) How does Microprocessor works? Explain in details [L1] [C02][4M]

The Figure 2.13(a) explains the concept of microprocessor and microcomputer in von Neumann The
microprocessor chip has to be interfaced to memory and I/O units to work as a computer for any application.
Figures 2.13(b) and 2.13(c) show the microprocessor and microcomputer chips connected to memory and I/O
units.
Clearly the microprocessor should be able to accept and send data from and to memory and I/O units. To
read a data from memory, the microprocessor should generate address of the location, and read control
signal for memory read. The microprocessor should also be able to accept data from memory. For
interfacing them Microprocessor to any input or output device the same information would be required.
Thus address, data and control signals are required to interface the microprocessor to memory and I/O
devices.The microprocessor fetches the first instruction

2.b) List different computer languages and explain them. [L2] [CO2]
[8M]
A programming language is a notation designed to connect instructions to a machine or a computer.
Programming languages are mainly used to control the performance of a machine or to express algorithms
Generally, there are three types of computer languages
1 Machine Level Language
2 Assembly Level language
3 High Level Language

Machine Level Language: Machine language is the language understood by a computer. It is


very difficult to understand, but it is the only thing that the computer can work with. All programs
and programming languages eventually generate or run programs in machine language. Machine
language is made up of instructions and data that are all binary numbers. Machine language is
normally displayed in hexadecimal form so that it is a little bit easier to read.
Assembly level language: Assembly language is almost the same as machine language,
except that the instructions, variables and addresses have names instead of just hex numbers. it
acts as the intermediate language between machine language and high-level programming
languages.
High Level Language

High Level Language

In comparison to machine language, assembly language is easier to write and use. A high-level
language (HLL) is a programming language such as C, FORTRAN, or Pascal that enables a
programmer to write programs that are less dependent on machine.
3.a) Write the steps required for writing and executing Assembly language Program andexplain the
procedure. [L2] [CO3] [4M]

Let us define a program statement as ‘Write and Executing Assembly Language Programming 8085 to add two
numbers’. The three tasks are involved in this program :

 Load two hex numbers


 Add numbers and
 Store the result in the memory
These tasks for Write and Executing Assembly Language Programming 8085 can be symbolicallypresented as
flow chart, as shown in the Fig.
Next job is to find the suitable 8085 assembly language instructions for each task. These instructions
are as follows:

.
Assembly Language Program to Machine Language Program:
Once the Assembly Language Programming 8085 is ready, it is necessary to convert it in the machine language
program. It is possible to do this by referring the proper hex code for each, assembly instruction from the 8085
instruction set manual. This process is known as hand assembly and the resulted machine language program is
also known as hex code. Let us see thehex code for our program.

Executing the Program:


The microprocessor training kit provides a procedure to execute the program. To activate the procedure we have
to enter the starting address of the program (2000H in our example). To enter this address we have to go into
execute mode by pressing GO key and enter the starting address using hex keys.

Once the starting address is entered, the program can be executed by pressing EXECUTE key. The EXECUTE
key procedure loads the starting address of our program, 2000H into the program counter and program control is
transferred from monitor program to our program.

Executing the Program:


The microprocessor training kit provides a procedure to execute the program. To activate the procedure we have
to enter the starting address of the program (2000H in our example). To enter this address we have to go into
execute mode by pressing GO key and enter the starting address using hex keys.

Once the starting address is entered, the program can be executed by pressing EXECUTE key. The EXECUTE
key procedure loads the starting address of our program, 2000H into the program counter and program control is
transferred from monitor program to our program. After this microprocessor reads one hex code at a time, and
when it fetches the complete instruction, it executes that instruction. Then it fetches the next instruction and this
process continues until the last instruction in the program is executed.
3.b) Differentiate low-level language and high-level language. [L2] [CO1] [4M]
Difference Between High-Level and Low-Level Languages
Parameter High-Level Language Low-Level Language
Basic These are programmer-friendly These are machine-friendly languages
languages that are manageable, easy that are very difficult to understand
to understand, debug, and widely used by human beings but easy to interpret
in today’s times. by machines.

Ease of These are very easy to execute. These are very difficult to execute
Execution

Process of High-level languages require the use Low-level language requires an


Translation of a compiler or an interpreter for assembler for directly translating the
their translation into the machine code instructions of the machine language

These languages have a very low


Efficiency of memory efficiency. It means that they These languages have a very high
Memory consume more memory than any low memory efficiency. It means that they
level language. consume less energy as compared to
any high-level language.

These are portable from any one


Portability device to another. A user cannot port these from one
device to another.
High-level languages are human
Comprehensibility friendly. They are, thus, very easy to Low-level languages are machine
understand and learn by any friendly. They are, thus, very difficult
programmer. to understand and learn by any
human.
. High-level languages do not depend
Dependency on Low-level languages are machine
on Machines machines. dependent and thus very difficult to
understand by a normal user.
It is very easy to debug these
Debugging languages. A programmer cannot easily debug
these languages.
High-level languages have a simple
Maintenance and comprehensive maintenance It is quite complex to maintain any
technique. low level language.

High-level languages are very


Usage common and widely used for Low-level languages are not very
programming in today’s times. common nowadays for programming

. High-level languages take more time


Speed of for execution as compared to low- The translation speed of low-level
Execution level languages because these require languages is very high. Abstraction
a translation program. High-level languages allow a higher
abstraction.
High-level languages allow a higher
Abstraction abstraction. Low-level languages allow very little
abstraction or no abstraction at all.
One does not require a knowledge of
Need of hardware for writing programs Having knowledge of hardware is a
Hardware prerequisite to writing programs.
.. High-level languages do not provide
Facilities various facilities at the hardware Low-level languages are very close to
Provided level. the hardware. They help in writing
various programs at the hardware
level.
The process of modifying programs is
Ease of very difficult with high-level The process of modifying programs is
Modification programs. it is because every single very easy in low-level programs.
. statement in it may execute a bunch Here, it can directly map the
of instructions. statements to the processor
instructions.
Some examples of high-level
Examples languages include Perl, BASIC, Some examples of low-level
COBOL, Pascal, Ruby, etc. languages include the Machine
language and Assembly language.

3.C) Define instruction and how it can be expressed in terms of symbolic code give example.
[L1] [CO2] [4M]
Instruction: An instruction (instruction format) is a command to the microprocessor to perform a
given task ona particular data. Instruction is a combination of opcode and operands.The instruction set
of a microprocessor is the collection of the instructions that the microprocessor is designed to execute.
The programmer can write a program in assembly language using instructions.
Instructions have been classified into the following groups:
1. Data Transfer
2. Arithmetic
3. Logical
4. Branch Control
5. Machine Control
Data Transfer: Which are used to transfer data from one register to another register, from memory to register
or register to memory, come under this group.
Examples are: MOV, MVI, LXI, LDA, STA etc.
When an instruction of data transfer is executed, data is transferred from the source to the destination without
altering the contents of the source.
For example, when MOV A, B is executed the content of the register B is copied into the register A, and the
content of register B remains unaltered.

Arithmetic
The instructions of this group perform arithmetic operations such as addition, subtraction; increment or
decrement of the content of a register or memory. Examples are: ADD, SUB, INR, DAD etc.
Logical
The Instructions under this group perform logical operation such as AND, OR, compare, rotate etc. Examples
are: ANA, XRA, ORA, CMP, and RAL etc.

Branch Control Group Instructions


This group includes the instructions for conditional and unconditional jump, subroutine call and return, and
restart. Examples are: JMP, JC, JZ, CALL, CZ, RST etc.

Machine Control Group Instructions


This group includes the instructions for input/output ports, stack and machine control.
Examples are: IN, OUT, PUSH, POP, and HLT etc.

4 a) How computers are classified? Explain in brief. [L1] [CO1] [6M]


Computers are classified into mainly three types
i) Large Computers
ii). Medium size Computers
iii). Microcomputers
1. Large computers
Large computers are multipurpose, multiuser, multitasking computers. These are used in computer scientific
and engineering calculations, handle large records for large corporations and government agencies. Large
computers are two types: Main frames and Super computers
Main frames
A mainframe computer (as storage for large database and serve as maximum number of users simultaneously)
is a computer used primarily by large organizations for critical applications, bulk data processing such as the
census and industry and consumer statistics, enterprise resource planning, and large-scale transaction
processing.
A mainframe computer is larger and has more processing power than other classes of computers, such as
minicomputers, servers, workstations, and personal computers. Most of the large-scale computer- system
architectures were established in the 1960s, but they continue to evolve. Mainframe computers are often used
as servers
Super computers
Super computers (large and complex mathematical Computations) are fastest high-performance systems
available at any given time. Such computers have been used primarily for scientific and engineering work
requiring exceedingly high- speed computations.
Common applications for supercomputers include testing mathematical models for complex physical
phenomena or designs, such as climate and weather, evolution of the cosmos, nuclear weapons and reactors,
new chemical compounds (especially for pharmaceutical purposes), and cryptology.
2. Medium size computers
(Minicomputers support more than 100 users at a time with multi terminal and time sharing)
Medium-size computer systems provide faster operating speeds and larger storage capacities than
minicomputer systems. They can support a large number of high-speed input/output devices and several disk
drives can be used to provide online access to large data files as required for direct access processing and their
operating systems also support both multiprogramming and virtual storage.
This allows the running of variety of programs concurrently. A medium-size computer can support a
management information system and can therefore serve the needs of a large bank, insurance company or
University
Microcomputers
A microcomputer is a complete computer on a small scale, designed for use by one person at a time.
Amicrocomputer is now primarily called a personal computer (PC), or a device based on a single-chip
microprocessor Common microcomputers include laptops and desktops.
i) Lap tops

A portable, compact computer that can run on an electrical wall outlet or a battery unit. All components
(keyboard, mouse, etc.) are in one compact unit. Usually more expensive than a comparable desktop.
Sometimes called a Notebook
ii) Workstation computers
A workstation is a special computer designed for technical or scientific applications. Intended primarily to be
used by one person at a time, they are commonly connected to a local area network and run multi-user
operating systems.
iii) Single board computers
A single-board computer (SBC) is a complete computer built on a single circuit board, with
microprocessor(s), memory, input/output (I/O) and other features required of a functional computer. Single
board computers are commonly made as demonstration or development systems, for educational systems, or
for use as embedded computer controllers. Many types of home computers or portable computers integrate all
their functions onto a single printed circuit board.

iv) Single chip microcomputer


Single-chip computers are mainly of the form known as Microcontroller chips and used in embedded devices.
They provide much more basic functionality but are far simpler to work with as they don't require any
external chips in order to function

b) List different types of microcomputers and with example. [L1] [CO1] [6M]
Microcomputers
A microcomputer is a complete computer on a small scale, designed for use by one person at a time.A
microcomputer is now primarily called a personal computer (PC), or a device based on a single-chip
microprocessor Common microcomputers include laptops and desktops.
i) Lap tops
A portable, compact computer that can run on an electrical wall outlet or a battery unit. All components
(keyboard, mouse, etc.) are in one compact unit. Usually more expensive than a comparable desktop.
Sometimes called a Notebook
ii) Workstation computers
A workstation is a special computer designed for technical or scientific applications. Intended primarily to be
used by one person at a time, they are commonly connected to a local area network and run multi-user
operating systems.
iii) Single board computers
A single-board computer (SBC) is a complete computer built on a single circuit board, with
microprocessor(s), memory, input/output (I/O) and other features required of a functional computer. Single
board computers are commonly made as demonstration or development systems, for educational systems, or
for use as embedded computer controllers. Many types of home computers or portable computers integrate all
their functions onto a single printed circuit board.

iv) Single chip microcomputer


Single-chip computers are mainly of the form known as Microcontroller chips and used in embedded devices.
They provide much more basic functionality but are far simpler to work with as they don't require any
external chips in order to function
5 Draw a block diagram of Microprocessor controlled temperature system and identify function of each
component. [L4] [CO2] [12M]
Microprocessor controlled temperature system
A Temperature Controlled System is a type of control system that automatically controls the temperature of an
object or an area. This system sets two-point upper limit point and lower limit point.
This system is excepted to read the temperature in room, display the temperature at LCD panel turn on a fan if the
temperature is above upper limit point and turn on a heater if the temperature below lower limit point. This system
has input and output ports for the connection of input and output devices like sensor, fan, heater and LCD etc.

System
hardware
1.Microprocess
2.Memory
3.Input devices
4.Output
devices
Microprocessor
The processor read the binary instructions from memory and execute those instructions
continuously, it will read temperature, display it at the LCD display panel, and turn on/off fan and
the heater based on the temperature
Memory
The system includes two types of memory
i. ROM- It is used to store the program called the monitor program, that is responsible for

providing the necessary instructions to the processor to monitor the system


ii. R/W - The read write memory is needed for temporary storage of data Input

In this system input device is temperature sensor a device that translates one form energy into
another form is called transducer, here temperature sensor is a transducer translate temperature
into an electrical signal A/D Converter
The electrical signal is converted into binary using A/D converter, the output of the A/D converter
is easily understand by the processor and generates control signals to output devices with respect
to the temperature Output
There are three output devices 1.fan or cooler 2.heater
3.LCD Fan
This is system output device that is turned on by the processor when the temperature reaches a set
higher limit Heater
This is turned on by the processor when the temperature reaches a lower limit.

6 List the three operations commonly performed by the Microprocessor or MPU. [L1] [CO2] [12M]

A memory unit stores binary information in groups of bits called words. Data input lines provide the
information to be stored into the memory, Data output lines carry the information out from the memory. The
control lines Read and write specifies the direction of transfer of data. Basically, in the memory organization,
there are 2^{l} memory locations indexing from 0 to 2^{l}-1 where l is the address buses. We can describe the
memory in terms of the bytes using the following formula:

N = 2^{l} Bytes
Where,
L is the total address buses
N is the memory in bytes
For example, some storage can be described below in terms of bytes using the above formula:
1kB= 2^10
64 kB = 2^6 x 2^10 Bytes
= 216 Bytes

Memory Address Register (MAR) is the address register which is used to store the address of the memory
location where the operation is being performed.
Memory Data Register (MDR) is the data register which is used to store the data on which the operation is
being performed.
Memory Read Operation:
Memory read operation transfers the desired word to address lines and activates the read controlline.
Description of memory read operation is given below:

In the above diagram initially, MDR can contain any garbage value and MAR is containing 2003 memory
address. After the execution of read instruction, the data of memory location 2003 will be read and the MDR
will get updated by the value of the 2003 memory location (3D).

Memory Write Operation:


Memory write operation transfers the address of the desired word to the address lines, transfers the data bits to
be stored in memory to the data input lines. Then it activates the write control line. Description of the write
operation is given below:
In the above diagram, the MAR contains 2003 and MDR contains 3D. After the execution of write instruction
3D will be written at 2003 memory location.

As a CPU needs to communicate with the various memory and input-output devices (I/O) as we know data
between the processor and these devices flow with the help of the system bus. There are three ways in which
system bus can be allotted to them :

Separate set of address, control and data bus to I/O and memory.
Have common bus (data and address) for I/O and memory but separate control lines.
Have common bus (data, address, and control) for I/O and memory.
In first case it is simple because both have different set of address space and instruction but require more buses.
Isolated I/O
Isolated I/O in which we have common bus(data and address) for I/O and memory but separate read
and write control lines for I/O. So when CPU decode instruction then if data is for I/O then it places the
address on the address line and set I/O read or write control line on due to which data transfer occurs between
CPU and I/O. As the address space of memory and I/O is isolated and the name is so. The address for I/O here
is called ports. Here we have different read-write instruction for both I/O and memory.

Memory Mapped I/O


In this case every bus in common due to which the same set of instructions work for memory and I/O. Hence
we manipulate I/O same as memory and both have same address space, due to which addressing capability of
memory become less because some part is occupied by the I/O.
Differences between memory mapped I/O and isolated I/O

Isolated I/O Memory Mapped I/O


Memory and I/O have separate address space Both have same address space
All address can be used by the memory Due to addition of I/O addressable memory become
less for memory
Separate instruction control read and write operation Same instructions can control both I/O and Memory
in I/O and Memory
More efficient due to separate buses Lesser efficient
In this I/O address are called ports. Normal memory address are for both
Larger in size due to more buses Smaller in size
It is complex due to separate logic is used to control Simpler logic is used as I/O is also treated as
both. memory only.

7 a) Describe the memory model of a typical memory chip. [L2] [CO1] [6M]
A memory is just like a human brain. It is used to store data and instructions. Computer memory is the storage
space in the computer, where data is to be processed and instructions required for processing are stored.
The memory is divided into large number of small parts called cells.

Classifications of memories There mainly two types

1. Primary memory
2. Secondary memory

Primary memory includes ROM and RAM, and is located close to the CPU on the computer motherboard, enabling the
CPU to read data from primary memory very quickly indeed.
Primary Memory Types:
i.RAM, or random access memory

ii.ROM, or read-only memory

i)RAM Computer Memory


The acronym RAM stems from the fact that data stored in random access memory can be accessed – as the name
suggests – in any random order. Or, put another way, any random bit of data can be accessed just as quickly as any
other bit.
The most important things to understand about RAM are that RAM memory is very fast, it can be written to as well
as read, it is volatile (so all data stored in RAM memory is lost when it loses power) and, finally, it is very
expensive compared to all types of secondary memory in terms of cost per gigabyte. It is because of the relative
high cost of RAM compared to secondary memory types that most computer systems use both primary and
secondary memory.
Types of RAM
• • DRAM: DRAM stands for Dynamic RAM, and it is the most common type of RAM used in computers.
The oldest type is known as single data rate (SDR) DRAM, but newer computers use faster dual data rate (DDR)
DRAM.
• • SRAM: SRAM stands for Static RAM, and it is a particular type of RAM which is faster than DRAM, but
more expensive and bulker, having six transistors in each cell. For those reasons SRAM is generally only used as a
data cache within a CPU itself or as RAM in very high-end server systems. A small SRAM cache of the most
imminently-needed data can result in significant speed improvements in a system.

ii)ROM Computer Memory


ROM stands for read-only memory, and the name stems from the fact that while data can be read from this type of
computer memory, data cannot normally be written to it. It is a very fast type of computer memory which is usually
installed close to the CPU on the motherboard.
ROM is a type of non-volatile memory, which means that the data stored in ROM persists in the memory even
when it receives no power – for example when the computer is turned off. In that sense it is similar to secondary
memory, which is used for long term storage.
Types of ROM is available in several different types, including PROM, EPROM, and EEPROM
• • PROM PROM stands for Programmable Read-Only Memory, and it is different from true ROM in that
while a ROM is programmed (i.e. has data written to it) during the manufacturing process, a PROM is
manufactured in an empty state and then programmed later using a PROM programmer or burner.
• • EPROM EPROM stands for Erasable Programmable Read-Only Memory, and as the name suggests, data
stored in an EPROM can be erased and the EPROM reprogrammed. Erasing an EPROM involves removing it from
the computer and exposing it to ultraviolet light before re- burning it.
• • EEPROM EEPROM stands for Electrically Erasable Programmable Read-Only Memory, and the
distinction between EPROM and EEPROM is that the latter can be erased and written to by the computer system it
is installed in.

Secondary Memory Types:


Secondary memory by contrast, is usually physically located within a separate storage device, such as a hard disk
drive or solid state drive (SSD), which is connected to the computer system either directly or over a network. The
cost per gigabyte of secondary memory is much lower, but the read and write speeds are significantly slower.
These include:
• hard disk drives
• solid state drives (SSDs)
• Optical (CD or DVD) drives
• Tape drives
• Storage arrays including 3D NAND flash arrays connected over a storage area network (SAN)
• Storage devices which may be connected over a conventional network (known as network attached storage,
or NAS)

7.b) Explain how memory addresses are assigned to a memory chip of size 1K (1024X8)? [L2] [CO1] [6M]
8.a)Illustrate the Instruction fetch operation from memory location 2005H [L2] [CO1] [6M]
9. Explain the difference between the peripheral I/O and memory mapped I/O. [L2] [CO2] [12M]
10 a) Illustrate the microcomputer system with example. [L3] [CO1] [6M]
The 8085 microprocessor is an example of a Microcomputer System. A microprocessor system contains
two types of memory that are EPROM and R/WM, Input and Output devices, and the buses that are used
to link all the peripherals (memory and I/Os) to the MPU. In 8085, we 16 address lines ranging from A0 to A15 that are
used to address the memory. The lower
order address bus A0-A7 is used in the identification of the input and output devices. This microcomputer
system has 8 data lines D0-D7 which are bidirectional and common to all the devices.
It generates four control signals: Memory Read, Memory Write, I/O Read, and I/O Write, and they are
connected to different peripheral devices. The MPU communicates with only one peripheral at a time by
enabling that peripheral through its control signal.
For example, sending data to the output device, the MPU places the device address (or output port
number) on the address bus, data on the data bus, and enables the output device by using its control signal
I/O Write. After that, the output device displays the result.
The other peripheral that is not enabled remain in a high impedance state called Tri-state. The bus drivers
increase the current driving capacity of the buses, the decoder decodes the address to identify the output
port, and the latch holds data output for display. These devices are called Interfacing devices. These
Interfacing devices are semiconductor chips that are needed to connect peripherals to the bus system.

The block diagram of a microcomputer system is shown below:

10 b) Draw the block diagram of output section of Microcomputer . Describe the role of tristate bus driver,
decoder and latch.

You might also like