Digital Computer Fundamentals and Microprocessor
Digital Computer Fundamentals and Microprocessor
UNIT – I
UNIT – II
Boolean Algebra and Gate Networks: Fundamentals concepts of Boolean Algebra – Logical
Multiplication AND Gates, OR Gates, and Inverters – Evaluation of logical Expressions –
Basic Law of Boolean Algebra – Simplification of expressions – De Morgan’s theorems – Basic
Duality of Boolean Algebra - Derivation of a Boolean Expression.
UNIT - III
Interconnecting Gates – Sum of products (SOP) and Products of sums (POS) – Derivation of
products of sums expressions – Derivation of three Input variable expression – NAND gates and
NOR gates - The Map method for simplifying expressions – Sub cube and covering – product of
sums expressions – Don’t cares.
UNIT – IV
UNIT –V
Programming the 8085: Introduction to 8085 Instructions ; Code conversion: BCD to Binary
conversion – Binary to BCD conversion – BCD to seven segment LED code conversion –
Binary to ASCII and ASCII to binary code conversion – BCD addition – BCD subtraction.
TEXT BOOKS
1. Digital Computer Fundamentals‖.(6TH Edition) Thomas C.Bartee, 6th Edition T.M.H
Publisher, New Delhi, 1991.(UNIT I, II & III)
2. ―Microprocessor Architecture Programming and Application with the 8085‖. Ramesh
Gaonkar, 5th Edition. (UNIT IV & V)
REFERENCE BOOKS:
1. Deborah Morley, Charles S. Parker, "Understanding Computers-
What is Computer:
Programmable machine.
numbers through a string of binary digits. The Word 'Computer' usually refers to the
•Charles Babbage is called the "Grand Father" of the computer. The First mechanical
computer designed by Charles Babbage was called Analytical Engine.It uses read-
•Computer is an advanced electronic device that takes raw data as input from the user
and processes these data under the control of set of instructions (called program) and
gives the result (output) and saves output for the future use. It can process both
Digital Computer
Input(Data):
• Input is the raw information entered into a computer from the input devices. It is the collection of
letters, numbers, images etc.
Process:
•Process is the operation of data as per given instruction. It is totally internal process of the
computer system.
Output:
•Output is the processed data given by computer after data processing. Output is also called as
Result. We can save these results in the storage devices for the future use.
Applications of Computer
Business
•A computer has high speed of calculation, diligence, accuracy, reliability, or versatility which
made it an integrated part in all business organisations.
•Computer is used in business organisations for: •Payroll
calculations
•Budgeting
•Sales analysis
•Financial forecasting
•Managing employees database
•Maintenance of stocks etc
Banking
•Banks provide online accounting facility, which includes current balances,deposits, overdrafts, interest
charges, shares, and trustee records.
•ATM machines are making it even easier for customers to deal with banks.
Insurance
•Insurance companies are keeping all records up-to-date with the help of computers. The insurance
companies, finance houses and stock broking firms are widely using computers for their concerns.
•Insurance companies are maintaining a database of all clients with information showing
•procedure to continue with policies
Education
•The computer education is rapidly increasing the graph of number of computer students.
•There are number of methods in which educational institutions can use computer to educate the students.
•It is used to prepare a database about performance of a student and analysis is carried out on this basis
Marketing
•In marketing, uses of computer are following:
•Advertising-With computers, advertising professionals create art and graphics, write and revise copy,
and print and disseminate ads with the goal of selling more products.
•At Home Shopping-Home shopping has been made possible through use of computerized catalogues that
provide access to product information and permit direct entry of orders to be filled by the customers
HealthCare
The computers are being used in hospitals to keep the record of patients
ECG, EEG, Ultrasounds and CT Scans etc., are also done by computerized
machines.
•Some major fields of health care in which computers are used are:
•Diagnostic System-Computers are used to collect data and identify cause of illness.
•Lab-diagnostic System-All tests can be done and reports are prepared by computer.
•Patient Monitoring System-These are used to check patient's signs for abnormality such as in
Cardiac Arrest, ECG etc.
•Pharma Information System-Computer checks Drug-Labels, Expiry dates, harmful drug’s side
effects etc.
•Surgery: Nowadays, computers are also used in performing
surgery.
Engineering Design
•One of major areas is CAD (Computer aided design). That provides creation and
modification of images. Some fields are:
•Structural Engineering- Requires stress and strain analysis for design of Ships, Buildings,
Budgets, Airplanes etc.
•Industrial Engineering-Computers deal with design, implementation and improvement of
integrated systems of people, materials and equipments.
•Architectural Engineering-Computers help in planning towns, designing buildings, determining a
range of buildings on a site using both 2D and 3D drawings.
Government
•Computers play an important role in government. Some major fields in this category are:
•Budgets
•Male/Female ratio
•Weather forecasting
Different Types of computer System
Basic components of Digital Computer System
All types of computers follow the same basic logical structure and perform the following
five basic operations for converting raw input data into information useful their users.
1 Take Input The process of entering data and instructions into the computer
system.
2 Store Data Saving data and instructions so that they are available for
processing as and when required.
Control the Directs the manner and sequence in which all of the above
5 operations are performed.
Input Unit
This unit contains devices with the help of which we enter data into the computer. This unit
creates a link between the user and the computer. The input devices translate the information into a form
understandable by the computer.
CPU (Central Processing Unit)
CPU is considered as the brain of the computer. CPU performs all types of data processing
operations. It stores data, intermediate results, and instructions (program). It controls the operation of all
parts of the computer.
CPU itself has the following three components −
Output Unit
The output unit consists of devices with the help of which we get the information from the
computer. This unit is a link between the computer and the users. Output devices translate the computer's
output into a form understandable by the users.
Central Processing Unit (CPU) consists of the following features −
• Arithmetic Section
• Logic Section
Arithmetic Section
Function of arithmetic section is to perform arithmetic operations like addition, subtraction,
multiplication, and division. All complex operations are done by making repetitive use of the above
operations.
Logic Section
Function of logic section is to perform logic operations such as comparing, selecting, matching,
and merging of data.
There are two types of programming languages, which can be categorized into the following way
This language is the most understandable language used by computer to perform its operations. It can
be further categorized into:
MachineLanguage(1GL)
Machine language consists of strings of binary numbers (i.e. 0s and 1s) and it is the only one language, the
processor directly understands. Machine language has an Merits of very fast execution speed and efficient
use of primary memory.
Merits:
¨ It is directly understood by the processor so has faster execution time since the programs written
in this language need not to be translated.
¨ It doesn’t need larger memory.
Demerits:
¨ It is very difficult to program using 1GL since all the instructions are to be represented by 0s
and 1s.
¨ Use of this language makes programming time consuming. It is difficult to
find error and to debug.
¨ It can be used by experts only.
Assembly Language
language uses mnemonics code (symbolic operation code like ‘ADD’ for addition) in
place of 0s and 1s. The program is converted into machine code by assembler. The
Merits:
¨ It is makes programming easier than 1GL since it uses mnemonics code for
programming. Eg: ADD for addition, SUB for subtraction, DIV for division, etc.
Programs written in this language is not directly understandable by computer so translators should be
used.
Instructions of this language closely resembles to human language or English like words. It uses
mathematical notations to perform the task. The high level language is easier to learn. It requires less time
to write and is easier to maintain the errors. The high level language is converted into machine language
by one of the two different languages translator programs;inter preteror compiler.
Procedural-Oriented language(3GL)
Procedural Programming is a methodology for modeling the problem being solved, by determining the
steps and the order of those steps that must be followed in order to reach a desired outcome or specific
program state. These languages are designed to express the logic and the procedure of a problem to be
solved. It includes languages such as Pascal, COBOL, C, FORTAN, etc.
Merits:
¨ Because of their flexibility, procedural languages are able to solve a variety of problems.
¨ Programmer does not need to think in term of computer architecture which makes them focused on
the problem.
Demerits:
It allows the users to specify what the output should be, without describing all the details
of how the data should be manipulated to produce the result. This is one step ahead from 3GL. These are
result oriented and include database query language.
Eg: Visual Basic, C#, PHP, etc.
The objectives of 4GL are to:
• Increase the speed of developing programs.
• Minimize user’s effort to botain information from computer.
• Reduce errors while writing programs.
Merits:
¨ Programmer need not to think about the procedure of the program. So, programming is much
easier.
Demerits:
¨ It is easier but needs higher processor and larger memory.
¨ It needs to be translated therefore its execution time is more.
Natural language(5GL)
Natural language are stil in developing stage where we could write statrments that
would look like normal sentences.
Merits:
¨ Easy to program.
¨ Since, the program uses normal sentences, they are easy to understand.¨ The programs
designed using 5GL will have artificial intelligence (AI). ¨ The programs would be much more
interactive and interesting.
Demerits:
¨ It is slower than previous generation language as it should be completely translated into
binary code which is a tedious task.
¨ Highly advanced and expensive electronic devices are required to run programs
developed in 5GL. Therefore, it is an expensive approach.
These are the different types of programming languages with their merits and demerits.
Memory
Number systems
A Number system defines a set of values used to represent the quantity. It has different types
of number systems
Background Information
Binary Numbers
A Binary number system has only two digits, which are 0 and 1. Every number (value) is represented
with 0 and 1 in this number system. The base of binary number system is 2, because it has only two
digits. Though DECIMAL (No 3) is more frequently used in Number representation,
BINARY is the number system form which the system/machine accepts.
Octal number system has only eight (8) digits from 0 to 7. Every number (value) is represented with
0,1,2,3,4,5,6 and 7 in this number system. The base of octal number system is 8, because it has only
8 digits.
3) Decimal number system
Decimal number system has only ten (10) digits from 0 to 9. Every number(value) is represented
with 0,1,2,3,4,5,6, 7,8 and 9 in this number system. The base of decimal number system is 10, because it
has only 10 digits.
A Hexadecimal number system has sixteen (16) alphanumeric values from 0 to 9 and A to F. Every
number (value) represents with 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E and F in this number system. The
base of hexadecimal number system is 16, because it has 16 alphanumeric values. Here, we have 0 to 9,
representing 0 – 9 but from 10, we have A is 10, B is 11, C is 12, D is 13, E is
•16
2 16
2 8 - 0 MSB
2 4 - 0
2 2 - 0
1 - 0 LSB
•A binary number can be converted into a decimal number by adding the products of each bit
and its weight.
METHOD: 1
•(101)
2 1 0
101 = 1 x 2 + 0 x 2 + 1 x 2 = 4 + 0+1
2
= 5
ANS: (101)2 = (5)10
Binary Fractions
METHOD:2
(1101.0111 ) 2
(1101.0111 )2 = 13.437510
•To convert a decimal number to octal, we have to divide the decimal number by 8 repeatedly and
collect the remainders from top to bottom
Convert Octal numbers to decimal number
Hexadecimal Number System
•To convert a decimal number to octal, we have to divide the decimal number by 8 repeatedly and collect
the remainders from top to bottom.
1) 10111.12
010111 . 1002
(2 7 . 4 )8
1) (110.101)
2
(0110.1010)2
(6 . A)16
Convert Octal number to binary
AND GATE
The AND gate is the logical circuit with the operation similar to logical multiplication.
Theyproduce thehighoutputif alltheinputs areinhighstate,thisgateproducelow output, when any one of
the inputs is low
OR GATE
The OR gate is similar to the operation of arithmetic addition. The OR gate
produce the high output when any one of the input is in high state. We get low output if either of the input
is low.
Complementation and inverters or NOT gate
In Boolean algebra, we have an operation called complementation and the symbol is
“ –”.
The complement is physically realized by a gate called inverter or NOT gate.
The NOT gate produce high output, when the input is low and low output when the input is high.
X Y Z Z’ YZ’ X + YZ’
0 0 0 1 0 0
0 0 1 0 0 0
0 1 0 1 1 1
0 1 1 0 0 0
1 0 0 1 0 1
1 0 1 0 0 1
1 1 0 1 1 1
1 1 1 0 0 1
The above is the truth table for the expression X + YZ’. The value Z is complemented
and the complemented value is multiplied with Y to get YZ’.
This column will have the value 1 only when both Y is a 1 and Z’ is a 1.
Now the value of YZ’ is performed logical addition with the value of X and the final
value is evaluated.
BASIC LAWS OF BOOLEAN ALGEBRA
A list of basic rules by which Boolean algebra expressions may be manipulated are
contained in this table.
Each rule may be proved by using the proof by perfect induction.
(X + Y) (X + Y) (X + Z)
Consider the two terms,
(X+Y) (X+Y’)
XX + XY’ + XY + YY’
X + XY’ + XY + 0 (YY = 0, XX = X)
X + X(Y’ +Y) ( Y’ + Y = 1)
X + X(1)
X+X (X+X=1)
X
Now multiply the term (X + Z)
X(X’+Z) X’ + XZ.
XZ. XX’ =0
1. X’ + Y’ = X’ . Y’
2. (X . Y)’ = X’ + Y’
ThecomplementofanyBooleanexpressionorapartofanyexpressionmaybefound by
means of these theorems.
Two steps are used to form a complement.
1. The (+) symbols are replaced with (.) and (.) symbol are replaced
with (+) symbol.
2. Each of the terms in the expression is complemented.
The complement of W’X+YZ’ is done by two steps:
The addition symbol is changed
The complement of each term is
formed. Ex:
(W’.X)’(Y.Z’)’
can be written as
(W+X’)(Y’+Z)
Since W and Z were already complemented, they become un complemented by the
theorem
X’ = X.
It is sometimes necessary to complement both sides of an equation. This may be done in
the same way as before:
WX+YZ =0
Complementing both sides gives
(WX+YZ)’ = 0’
(W’+X’)(Y’+Z’) =1
(XY)’ + X (Y’ + Y) = Z
(XY)’ + X (1) = Z (XY)’ + X = Z
X + Y ‘= Z
Truth table for three input values X,Y and Z
X Y Z Output
A
0 0 0 1
0 0 1 0
0 1 0 1
0 1 1 0
1 0 0 1
1 0 1 0
1 1 0 1
1 1 1 0
A column is added to listing the inputs, A, Y,and Z according to their values in the input
columns.
The product terms from each row in which the output is a 1 are collected ((XYZ)’, X’YZ’,
XY’Z’, and XYZ’) and the desired expression is the sum of these products (X’Y’Z’+
X’YZ’+XY’Z’+XYZ’).
Therefore, the complete expression in standard form for the desired network is
Interconnecting Gates
what is the logic expression following logic circuit
• An SOP expression when two or more product terms are summed by Boolean addition.
Examples:
AB + ABC
ABC + CDE + B CD
A B + A BC + AC
Also:
A + A B C + BCD
• In an SOP form, a single over bar cannot extend over more than one variable; however, more than
one variable in a term can have an over bar:
Examples:
A B C is ok
But not:
ABC
Implementation of an SOP
• X=AB+BCD+AC
• AND/OR implementation
• NAND/NAND implementation
Examples:
A + B +C is ok
Also:
A+ B +C
Implementation of a POS
• X=(A+B)(B+C+D)(A+C)
• OR/AND implementation
NAND Gate
Complemented AND gate
What is K-Map
• It’s similar to truth table; instead of being organized (i/p and o/p) into columns and rows, the
K-map is an array of cells in which each cell represents a binary value of the input variables.
• The cells are arranged in a way so that simplification of a given expression is simply a matter
of properly grouping the cells.
• K-maps can be used for expressions with 2, 3, 4, and 5 variables.
3 and 4 variables will be discussed to illustrate the principles.
The 2 Variable K-Map
• F(A,B) = AB + AB
F(A,B) = AB + AB + AB
The 3 Variable K-Map
• F(A,B,C) = ∑ (0,1,6,7)
F(A,B,C) = ∑ (0,2,5,7)
The 3 Variable K-Map
• F(A,B,C,D) = ∑ (0,1,2,3,4,5,6,7)
• F(A,B,C,D) = ∑ (0,1,2,4,5,10,11,14,15)
MICROPROCESSORS
PROGRAMMABLE DEVICE:
The microprocessor can perform different sets of operations on the data it receives
depending on thesequence ofinstructions supplied in the given program.
Bychangingtheprogram,themicroprocessormanipulates thedatain differentways.
Instructions:
Each microprocessor is designed to execute a specific group of operations.
This group of operations is called an instruction set.
Takes in:
The data that the microprocessor manipulates must come from somewhere.
It comes from what is called “input devices”.
These are devices that bring data into the system from the outside world.
These represent devices such as a keyboard, a mouse, switches, and the like.
NUMBERS:
It only understands binary numbers.
A binary digit is called a bit (which comes from binary digit).
The microprocessor recognizes and processes a group of bits together. This group of
bits is called a “word”.
They processed information 8-bits at a time.
Later microprocessors (8086 and 68000) were designed with 16-bit words.
A group of 8- bits were referred to as a “half-word” or “byte”.
A group of 4 bits is called a “nibble”.
Also, 32 bit groups were given the name “long word”.
Today, all processors manipulate at least 32 bits at a time and there exists microprocessors
that can process 64, 80, 128 bits Words, Bytes, etc.The earliest microprocessor (the Intel 8088
and Motorola’s 6800) recognized 8-bit words.
Memory is usually measured by the number of bytes it can hold. It is measured in
Kilos, Megas and lately Gigas. A Kilo in computer language is 210 =1024. So, a KB (KiloByte) is
1024 bytes. Mega is 1024 Kilos and Giga is 1024 Mega.
Microprocessor Digital
· 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.
ALU
Memory
· Control Unit-The group of circuits that provides timing and signals to all operations in the
computer and controls data flow.
· Memory-a medium that stores binary information (instructions and data).
· Input -a device that transfers information from the outside world to the computer
MACHINE LANGUAGE
The number of bits in a word for a given machine is fixed, and words are formed through
various 'combinations of these bits. For example; a machine with a word length of eight bit scan
have 756 (28) combinations of eight bits-thus a language of 256 words.
The Z80 is a microprocessor with 8-bit word length .Its instruction set (or language) is
upward compatible with that of the 8080; the Z80 has 158 instruction types that include the entire
8080 set of 72 instruction types.
Even though the instructions can be written in hexadecimal code, it is still not easy to
understand such a program. Therefore, each manufacturer of microprocessors has devised a
symbolic code for each instruction, called a mnemonic.
ASCII Codes
A computer is a binary machine; in order to communicate with the computer in alphabetic letters
and decimal numbers. translation codes are necessary. The commonly used code is known as
ASCII-American Standard Code for Information Interchange..
Another code, called EBCDIC (Extended Binary Coded Decimal Interchange Code) is widely
used in IBM computers
HIGH-LEVEL LANGUAGES
OPERATING SYSTEMS:
The interaction between the hardware and the software is managed by a set of programs called
an operating system of a computer.
LARGE COMPUTERS:
These are large, general-purpose, multi-user, multitasking computers designed to
perform such data processing tasks as complex scientific and engineering calculations and
handling of records for large corporations or government agencies.
MEDIUM-SIZE COMPUTERS:
In the 1960s, these computers were designed to meet the instructional needs of small
colleges, the manufacturing problems of small factories, and the data processing tasks of
medium-size businesses, such as payroll and accounting. These were called mini-computers.
These machines were slower and smaller in memory capacity than mainframes.
MICRO COMPUTERS:
The 4-bit and 8-bit microprocessors became available in the nid-1970s, and initial
applications were primarily in the areas of machines control and instrumentation. Present- day
microcomputers can be classified in four groups: personal (or business) computers (PC), work
stations,single-board,andsingle-chipmicrocomputers(microcontrollers).
WORKSTATIONS:
These are high-performance cousins of the personal computers. They are used in
engineering and scientific applications such as computer-aided design (CAD), computer- aided
engineering (CAE), and computer-aided manufacturing (CAM).They generally include system
memory and storage (hard disk) memory in gigabytes, and a high-resolution screen. The RISC
processors tend to be faster and more efficient than the processor used in personal computers.
SINGLE-BOARD MICROCOMPUTERS:
These microcomputers are primarily used in college laboratories and industries for
instructional purpose or to evaluate the performance of a given microprocessor. They can also
be part of some larger system.
SINGLE CHIP MICROCOMPUTERS:-
These microcomputers are designed on a single chip, which typically includes a micro
processor, 256 bytes of R/W memory, from 1K to 8K bytes of ROM, and several signal lines to
connect I/Os.
To communicate with the peripheral (or a memory location), the MPU needs the
following steps.
Step 1: Identify the peripheral or the memory location with its
address. Step 2: Transfer binary information.
Step 3: Provide timing or synchronization signals.
To perform these functions using three sets of communication lines called buses
Address Bus
8085 MPU
Memory Input Output
Data Bus
Control Bus
Address bus
Group of 16 lines identified as A0 to A15.
The address bus is unidirectional. Bits flow in one direction- from the MPU to
peripheral devices.
The MPU uses this bus to perform step1.
In computer, each peripheral or memory location is identified by a number called an
address, used to carry 16-bit address.
Data bus
Group of 8 lines are used for data flow.
Bi-directional data flow in both direction, between the MPU and memory and
peripheral devices.
The MPU uses this bus to perform step2.
The 8 lines enable the MPU tomanipulate 8-bit data ranging from 00 to FF(2 = 256 numbers).
Control bus
This bus is comprised of various single lines that carry synchronization signals.
The MPU uses this bus to perform step3.
The MPU generates specific control signals for every operation it performs.
The MPU sends a pulse called Memory Read as the control signal.
The pulse activates the memory chip and the contents of the memory location are placed
on the data bus.
Input/output devices are the means through which the MPU communicates with “ the
outside world”.
The MPU accepts binary data as input from devices such as keyboards and A/D
converters and sends data to output devices such as LEDs or printers.
I/Os with 8-bit addresses (peripheral-mapped I/O)
The MPU uses eight address lines to identify an input or an output device. This is
known as peripheral-mapped I/O.
The eight address lines can have 256(2 combinations) address. MPU can identify256
input devices and 256 output devices with addresses ranging from 00H to FFH.
The input and output devices are differentiated by thecontrol signals, the MPU uses the
I/O readcontrol signals forinput devicesandI/O writecontrol signals foroutput
device.
The steps in communicating with an I/O device are as follows.
The MPU places an 8-bit address on the address bus, which is decoded by
external decode logic.
The MPU sends a control signal (I/O read or I/O write) and enables the I/O device.
Data are transferred using the data bus.
I/O with 16-bit addresses (Memory-Mapped I/O)
The MPU uses 16 addresses lines to identify an I/O device.
An I/O is connected as if it is a memory register known as memory mapped I/O.
The MPU uses the same control signal and instructions as those of memory.
In some microprocessors, all I/Os have 16-bit addresses. I/Os and memory share the
same memory map.
This includes two control signals (RD and WR) three status signals (I/O, S1 and S0) and
one special signal (ALE) to indicate the beginning of the operation.
ALE – Address Latch Enable
This signal is used primarily to latch the low-order address from the multiplexed bus
and generate a separate set of eight address lines A7 – A0.
RD – Read
This signal indicates that the selected I/O or memory device is to be read and data
are available on the data bus.
WR – Write
This signal indicates that the data on the data bus are to be written into a selected memory or
I/O location.
IO/M
This signal is used to differentiate between I/O and memory operations. When it is high, it
indicates an I/O operation; when it is low, it indicates a memory operation.
S1 and S0
These signal signals, similar to IO/M can identify various operations, but they are rarely used in
small systems.
The 8085 have five interrupt signals that can be used to interrupt a program execution.
In addition to the interrupts, three pins-RESET, HOLD and READY-accept the
externally initiated signals as inputs.
INTR – interrupt request.
This is used asa general purpose interrupts; it is similar to the INT signal of
8080A. INTA- interrupt acknowledge.
it is used to acknowledge an
interrupt. RST 7.5, RST 6.5, RST 5.5
– restart interrupts.
It transfers the program control to specific memory locations. They have higher priority
than the INTR interrupt.
TRAP
Non-maskable, highest priority interrupt.
HOLD
Indicates that a peripheral is requesting the use of the address and data buses.
HLDA – hold acknowledge:
Acknowledges the Hold request.
READY
This signal is used to delay the microprocessor read and write cycles until a slow responding
peripheral is read to send or accept data.
RESET IN
When the signal on this pin goes low the program counter is set to zero.
RESET OUT
This signalindicatesthat theMPU is being reset. Thissignalcan beused to reset otherdevices.
DEMULTIPLEXING THE BUS AD7 – AD0
The address on the high-order bus (20H) remains on the bus for three clock periods. However, the
low-order address (05H) is lost after the first clock period.
This address needs to be latched and used fro identifying the memory address. If the bus AD7- AD0 is used to
identify the memory location (2005H), the address will change after first clock period.
Instruction cycle
It is defined as the time required to complete the execution of an instruction. The 8085 instruction
cycle consists of one to six machine cycles or one to six operations.
Machine cycle
It is defined as the time required to complete one operation of accessing memory, I/O, or acknowledge
an external request. This cycle may consist of three to six T-states.
T-state
It is defined as one subdivision of the operation performed in one clock period. These subdivisions
are internal states synchronized with the system clock, and each T-state is equal to one clock period.
Register array
In addition to the 8085 programmable registers, two additional registers called temporary registers W
and Z are included in the register array.
These registers are used to hold 8-bit data during the execution of some instruction.
The microprocessor:
1. Places the contents of the data bus(4FH) in the instruction register and decodes the
instruction.
2. Transfers the contents of the accumulator (82H) to the temporary register in the ALU.
3. Transfers the contents of the temporary register-to-register C.
To illustrate Memory read machine cycle, we need to examine the execution of a 2-byte or 3- byte
instruction because in a 1-byte instruction the machine code is an opcode fetching. Therefore the
operation is always an opcode fetch.
Consider two machines codes- 0011 1110(3EH) and 0011 0010(32H) are stored in memory locations
2000H and 2001H.
the first machine code represents the opcode to load the data byte in the accumulator, and the second
code( 32H) represents the data byte to be loaded in the accumulator.
Step 1: The first machine cycle M1 (opcode fetch) is identical in bus timings with the
machine cycle except for the bus contents.
At T1, the microprocessor identifies that it is an opcode fetch cycle by placing 011
on the status signals (IO/M = 0, S1 = 1 and S0 = 1).
It places the memory address (2000H) from the program counter on the address bus,
20H on A15-A8, and 00H on AD7-AD0 and increments the program counter to
2001H to point to the next machine code.
Step 2: After completion of the opcode fetch cycle, the 8085 places the address 2001H on the
address bus and increments the program counter to the next address 2002H.
The second machine cycle M2 is identified as the memory read cycle(IO/M = 0, S1 = 1 and S0
= 0) and the ALE is asserted. At T2 the RD signal becomes active and enables the
memory chip.
Step 3: At the rising edge of T2, the 8085 activates the data bus as an input bus and memory
places the data byte 32H on the data bus, and the 8085 reads and stores the byte in the
accumulator during T3.
Memory interfacing
Memory is an integral part of a microcomputer system.
While executing a program, the microprocessor needs to access memory quite
frequently to read instruction codes and data stored in memory.
The interfacing unit enables this access.
Memory has certain signals requirements to write into and read from and write into memory.
The interfacing process involves designing a circuit that will match the memory
requirements with the microprocessor signals.
Memory structure and its requirements
A typical R/W memory chip has 2048 registers and each register can store eight bits
indicated by eight input and eight output data lines.
The chip has 11 address lines A10 – A0, one chip select (CS) and two control lines
read(RD) to enable the output buffer and write (WR) to enable the input buffer.
The internal decoder is also used to decode the address lines.
A typical EPROM(erasable programmable read-only memory) has 4096(4K)
registers. It has 12 address lines A11- A0, one chip select (CS), and one read
control signal.
Basic concepts in memory interfacing
The primary function of memory interfacing is that the microprocessor should be
able to read from and write into a given register of a memory chip. To perform these
operations, the microprocessor should
Be able to select the chip
Identify the register
Enable the appropriate buffer
The 8085 place a 16-bit address on the address bus, and with this address only one
register should be selected. For the memory chip, only 11 address lines are required to
identify 2048 registers.
We connect the low order address lines A10-A0 of the 8085-address bus to the memory chip.
The remaining address lines (A15 – A11) should be decoded to generate a chip
select (CS) signal unique to that combination of address logic.
The 8085 provides two signals-IO/M and RD can be combined to generate MEMR
control signal that can be used to enable the output buffer by connecting to the
memory signal RD.
To write into a register, the microprocessor performs similar steps as it reads from a register.
The 8085 places the address and data and asserts the IO/M signal.
The IO/M and WR signals can be combined to generate the MEMW control
signals that enables the input buffer of the memory chip and stores the byte in the
selected memory register.
Demultiplexed Address Bus
Address decoding
This process is to identify a register for a given address.
The address lines (A11-A0) are connected to the memory chip and the
remaining four address lines (A15-A12) are decoded.
Two methods of decoding these lines are
Using a NAND gate
3 to 8 decoder
The output of the NAND gate goes active and selects thechip only when all the address
lines are at logic 1(A15-A12).
We can obtain the same result by using O7 of the 3 to 8 decoder, capable of decoding
eight different input addresses.
Three lines can have eight different logic combinations from 000 to 111. each
input combination is identified by corresponding output line.
If enable lines are active, the lines E1 and E2 are enabled by grounding and A15 must
be at logic 1 to enable E3.
Interfacing circuit
The above figure shows an interfacing circuit using a 3 to 8 decoder to interface the
2732 EPROM chip.
Step 1: The address lines A11-A0 are connected to pins A11-A0 of the memory chip to
address 4096 registers.
Step 2: The decoder is used to decode four address lines A15-A12. the output O0 of the
decoder is connected to chip enable (CE). The CE is asserted only when the address on A15-
A12 is 0000. A15 enables the decoder and the output asserts the output O0.
Step3: we need one control signal: memory read(MEMR), active low. The MEMR is
connected to OE to enable output buffer. OE is same as RD.
Address decoding and memory addresses
The logic levels on the address lines A15-A12 must be 0000 to assert the chip
enable, and the address lines A11-A0 can assume any combinations from all 0s
and 1s. the memory address of the chip ranges from 0000H to 0FFFH will be as
follows.
The chip’s 4096 bytes of memory can be viewed as 16 pages with 256 lines each. The
high- order hex digits range from 00 to0F, indicating 16 pages-0000H to 00FFH
and 0100H to 01FFH.
UNIT V
Programming the 8085: Introduction to 8085 Instructions ; Code conversion: BCD to
Binary conversion – Binary to BCD conversion – BCD to seven segment LED code
conversion – Binary to ASCII and ASCII to binary code conversion – BCD addition – BCD
subtraction.
PROGRAMMING TO 8085
INTRODUCTION THE 8085 INSTRUCTIONS
Each instruction in the program is a command, in binary, to the microprocessor to
perform an operation. The entire group of instruction called the instruction set. The
instruction can be classified into five different categories.
Instruction
Arithmetic
Logical
Branching
Machine control
MOV Rd, Rs
Move
This is a 1 byte instruction
Copies data from source register Rs to
LDAX Rp
Load Accumulator Indirect
This is a 3-byte instruction.
It copies the data byte from the memory location
specified by the 16-bit address in the second and third
byte.
The second byte is a low-order memory address.
The third byte is a high-order memory address.
The addressing mode is direct.
ARITHMETIC OPERATIONS
The arithmetic operations are add, subtract, increment and decrement. The add and
subtract operations are performed in relation to the content of the accumulator.
The increment or the decrement operations can be performed in any register.
Opcode Operand Description
R
ADD Add
This is a 1-byte instruction.
Add the contents of register R to the
contents of th accumulator.
8-bit
ADI Add Immediate
This is a 2-byte instruction.
Addsthesecondbytetothecontentsofthe
accumulator.
SUB R
Subtract
This is a 1-byte instruction
Addsthesecondbytetothecontentsofthe
accumulator.
SUI 8-bit
Subtract Immediate
This is a 2-byte instruction
Subtracts the second byte from the contents of the
accumulato
INR R
Increment
Increases the contents of register R by 1.
R
DCR Decrement
Decreases the contents of register R by 1.
INX Rp Increment Register Pair.
This is a 1-byte instruction.
It treats the contents of two registers as one 16-bit
number an increases the contents by 1.
The instruction set includes four instructions.
DCX Rp
Decrement Register Pair
This is a 1-byte instruction.
It decreases the 16-bit contents of a register
pair by 1.
The instruction set includes four instructions.
LOGIC OPERATIONS
The logic operations are performed in relation to the contents of the accumulator.
The logical instructions are AND, OR, EX OR and NOT.
Unconditional jump
The 8085 instruction set includes one unconditional jump instructions.
Direct addressing
Simply giving the complete binary address in memory is the most direct way to locate
an operand or to give an address to jump.
Example: LDA 3A
The 8-bit address in the memory to be loaded into the accumulator
Register addressing
The instruction specifies a register pair that contains the memory address where the
data are located.
Example: MOV Rd, Rs
It moves the content of source to the destination register. The operand is stored in
one of the CPU register.
Indirect addressing
The instruction indicates a register pair that contains the address of the next
instruction to be executed.
Example: MOV M, C
TheaboveinstructionmovesthecontentsoftheCregisterintothememoryaddress
stored in register pair.
Immediate addressing
Immediate addressing refers to move the immediate data to any of the registers,
accumulators or memory.
CODE CONVERSION
BCD addition
Location
Program Explanation
START LXI SP, Initialize the stack pointer
STACK
LXI H, 9000H
MVI C, Load register C with the count of BCD number to be added
COUNT
XRA A Clear the accumulator
MOV B, A Move the accumulator to register
NXT CALL Call the subroutine
BCDADD
INX H Increment the HL register pair
DCR C Decrement the C register
JNZ NXT If all numbers are added goto next step otherwise go back
LXI H, 9063H Point index used to store the BCD1 first
CALL Unpack the BCD stored in the accumulator
UNPACK
MOV A, B Move the B register to the accumulator
CALL Call the subroutine
UNPAK
HLT Terminate the program
BCDADD ADD M Add packed BCD byte and adjust it for BCD sum
DAA
RNC If no carry go back to next BCD
MOV D, A If carry is generated save the sum from the accumulator to D
MOV A, B Move the B register to accumulator
ADI 01H Add 01H
DAA Decimal adjust BCD from B
MOV B,A Save adjusted BCD in B
MOV A, D Place BCD1 and BCD2 in accumulator
RET Return
UNPAK MOV D, A Save BCD number
ANI OFH Mask high order BCD
MOV M, A Store low order BCD
DCX H Point to next memory
MOV A, D Get BCD again
ANI F0H Mask low order BCD
RRC Convert the MSB bits to unpacked BCD
RRC
RRC
RRC
MOV M, A Move the content of accumulator to memory
DCX H Point to next memory location
RET Return
BCD subtraction
When subtracting two BCD numbers