unit-iii telugu ack

Upload: narasimha-murthy-yayavaram

Post on 07-Apr-2018

223 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/6/2019 Unit-III Telugu Ack

    1/46

    3. INTRODUCTIONTO MICROCOMPUTERAND MICROPROCESSOR

    3.0 Introduction

    A Microprocessor is a multipurpose programmable logic device which reads thebinary instructions from a storage device called Memory accepts binary data as input and

    process data according to the instructions and gives the results as output. So, you canunderstand the Microprocessor as a programmable digital device, which can be used for bothdata processing and control applications. In view of a computer student, it is the CPU of aComputer or heart of the computer. A computer which is built around a microprocessor iscalled a microcomputer. A microcomputer system consists of a CPU (microprocessor),memories (primary and secondary) and I/O devices as shown in the block diagram in Fig 3.1.The memory and I/O devices are linked by data and address (control) buses. The CPUcommunicates with only one peripheral at a time by enabling the peripheral by the controlsignal. For example to send data to the output device, the CPU places the device address onthe address bus, data on the data bus and enables the output device. The other peripheralsthat are not enabled remain in high impedance state called tristate.

    3.1 Evolution of Microprocessors

    The first Microprocessor was designed by Intel Corporation which was founded by Mooreand Noyce in 1968. In the early years, Intel focused on developing semiconductor memories(DRAMs and EPROMs) for digital computers. In 1969, a Japanese Calculator manufacturer ,Busicom approached Intel with a design for a small calculator which need 12 custom chips. TedHoff, an Intel Engineer thought that a general purpose logic device could replace the multiplecomponents.This idea led to the development of the first so called microprocessor. So,Microprocessors started with a modest beginning of drivers for calculators. Fedrico Faggin andStanely Mazor implemented the ideas of Ted Hoffs and designed the Intel 4000 family of

    processors comprising 4001 (2K-ROM), the 4002 (320 bit RAM), the 4003 (10 bit I/O shift-register) and the 4004, a 4 bit CPU. Intel introduced the 4004 microprocessorto the world widemarket on November 15, 1971. It was a 4-bit PMOS chip with 2300 transistors. Around thesame time Texas Instruments developed a 4-bit microprocessor TMS 1000 and became theowner of microprocessor patent. Later Intel introduced worlds first 8 bit general purposemicroprocessor 8008 in 1972. This processor was used in the popular computer Mark-8 inthose days. In 1974, Intel introduced the improved version of 8008, the 8080 microprocessor.This 8080 is the much more highly integrated chip than its predecessorswhich is built around N-channel MOS technology.It could execute upto 290,000 operations per second and couldaddress upto 64K.bytes of memory. The other notable 8 bit microprocessors include Motorola6800, Rockwell PPS-8 and Signetics 2650 with powerful architecture and instruction set.

    With developments in integration technology Intel was able to integrate the additionalchips like 8224 clock generator and the 8228 system controller along with 8080 microprocessorwith in a single chip and released the 8 bit microprocessor8085 in the year 1976. The 8085microprocessor consisted of 6500 MOS transistors and could work at clock frequencies of 3-5M.Hz.It works on a single +5 volts supply.The other improved 8 bit microprocessors includeMotorola MC 6809, Zilog Z-80 and RCA COSMAC.

    In 1978 ,Intel introduced the 16 bit microprocessor8086 and 8088 in1979. IBM selectedthe Intel 8088 for their personal computer (IBM-PC).8086 microprocessor made up of 29,000

    MOS transistors and could work at a clock speed of 5-10 M.Hz.It has a 16-bit ALU with 16-bitdatabus and 20-bit address bus.It can address up to 1MB of address space.The pipeliningconcept was used for the first time to improve the speed of the processor.It had a pre-fetchqueue of 6 instructions where in the instructions tobe executed were fetched during the executionof an instruction.It means 8086 archtecture supports parallel processing.The 8088

    1

  • 8/6/2019 Unit-III Telugu Ack

    2/46

    microprocessor is similar to 8086 processor in architecture ,but the basic difference is it has only8-bit data bus even though the ALU is of 16-bit.It has a pre-fetch queue of 4-instructions only.

    In 1982 Intel released another 16-bit processor called 80186 designed by a team under theleadership of Dave Stamm.This is having higher realiability and faster operational speed but at alower cost.It had a pre-fetch queue of 6-instructions and it is suitable for high volume applicationssuch as computer workstations,word-processor and personal computers.It is made up of 134,000MOS transistors and could work at clock rates of 4 and 6 M.Hz.This is also comes under first

    generation of Microprocessors.

    Intel released another 16 bit microprocessor80286 having 1,34,000 transistors in 1981. It wasused as CPU in PC-ATs in 1982. It is the second generation microprocessor ,more advanced to80186 processor. It could run at clock speeds of 6 to 12.5 M.Hz .It has a 16-bit data bus and 24-bit address bus ,so that it can address upto 16MB of address space and 1GB of virtual memory.Ithad a pre-fetch queue of 6 instructions .Intel introduced the concept of protected mode andvirtual modeto ensure proper operation.It also had on-chip memory management unit (MMU).This was popularly called as Intel 286 in those days.

    In 1985, Intel released the first 32 bit processor80386, with 275,000 transistors. It has 32-

    bit data bus and 32-bit address bus so that it can address up to a total of 4GB memory also avirtual memory space of 64TB.It could process five million instructions per second and couldwork with all popular operating systems including Windows.It has a pre-fetch queue of length 16-bytes with extensive memory management capabilities. It is incorporated with a concept calledpaging in addition to segmentation technique. It uses a math co-processor called 80387.

    Intel introduced 80486 microprocessor with a built-in maths co-processor and with 1.2 milliontransistors . It could run at the clock speed of 50 M.Hz This is also a 32 bit processor but it istwice as fast as 80386.The additional features in 486 processor are the built-in Cache and built-inmath co-processors.The address bus here is bidirectional because of presence of cache

    memory.

    On 19th October,1992, Intel released the Pentium Processorwith 3.1 million transistors. So,thePentium began as fifth generation of the Intel x86 architecture.This Pentium was a backwardcompatible while offering new features.The revolutionary technology followed is that the CPU isable to execute two instruction at the same time..This is known as super scalar technology. ThePentium uses a 32-bit expansion bus ,however the data bus is 64 bits.

    The 7.5 million transistors based chip,Intel Pentium II processor was released in 1997. It worksat a clock speed of 300M.Hz. Pentium II uses the Dynamic Execution Technology which consistsof three different facilities namely, Multiple branch preditction,Data flow analysis, and Speculativeexecution unit. Another important feature is a thermal sensor located on the mother board canmonitor the die temperature of the processor.for thermal management applications.

    Intel Celeron Processors were introduced in the year 1999. Pentium-III processor with 9.5million transistors was introduced in 1999. It also uses dynamic execution micro-architecture ,aunique combination of multiple branch prediction ,dataflow analysis and speculativeexecution.The Pentium III has improved MMX and processor serial numberfeature.The improvedMMX enables advanced imaging,3D streaming audio and vedio,and speech recognition for enhanced

    Internet facility.

    Pentium-IV with 42 million transistors and 1.5 G.Hz clock speed was released by Intel inNovember 2000. The Pentium 4 processor has a system bus with 3.2 G-bytes per second ofbandwidth.This high bandwidth is a key reason for applications that stream data frommemory.This bandwidth is achieved with 64 bit wide bus capable of transferring data at a rate of

    2

  • 8/6/2019 Unit-III Telugu Ack

    3/46

    400 MHz. The Pentium 4 processor enables real-time MPEG2 video encoding and near real-time MPEG4 encoding, allowing efficient video editing and video conferencing.

    Intel with partner Hewlet-Packard developed the next generation 64-bit processorarchitecture called IA-64 .This first implementation was named Itanium.Itanium processor whichis the first in a family of 64 bit products was introduced in the year 2001.The Itanium processorwas specially designed to provide a very high level of parallel processing ,to enable highperformance without requiring very high clock frequencies .Key strengths of the Itanium

    architecture include ,up to 6 instructions/cycle.The Itanium processor can handle up to 6simultaneous 64 bit instructions per clock cycle.

    The Itanium II is an IA-64 microprocessor developed jointly by Hewlet-Packard (HP)and Intel and released on July 8,2002..It is theoretically capable of performing nearly 8 timesmore work per clock cycle than other CISC and RISC architectures due to its parallel computingmicro-architecture.The recent Itanium processor features a split L2 cache,adding a dedicated1MB L2 cache for instructions and thereby effectively growing the original 256KBL2 cache, whichbecomes a dedicated data cache. The first Itanium 2 processor (code named McKinley) wasmore powerful than the original Itanium processor , with approximately two times performance .

    Pentium 4EE was released by Intel in the year 2003 and Pentium 4E was released in theyear 2004.

    The Pentium Dual-Core brand was used for mainstream x86-architecture microprocessorsfrom Intel from 2006 to 2009 The 64 bit Intel Core2 was released on July 27,2006. In terms offeatures, price and performance at a given clock frequency, Pentium Dual-Core processors werepositioned above Celeron but below Core and Core 2 microprocessors in Intel's product range. ThePentium Dual-Core was also a very popular choice for overclocking, as it can deliver optimalperformance (when overclocked) at a low price.

    The Pentium DualCore, which consists of 167 million transistors was released on January 21,2007. Intel Core Duo consists of two cores on one die, a 2 MB L2 cache shared by both cores,and an arbiter bus that controls both L2 cache and FSB access.

    Core 2 Quad processors are multi-chip modules consisting of two dies similar to those used inCore 2 Duo, forming a quad-core processor. While this allows twice the performance to a dual-core processors at the same clock frequency in ideal conditions, this is highly workload specificand requires applications to take advantage of the extra cores.

    In September.2009, new Core i7 models based on the Lynnfield desktop quad-core processorand the Clarksfield quad-core mobile were added, and models based on the Arrandale dual-core

    mobile processor have been announced. The first six-core processor in the Core lineup is theGulftown, which was launched on March 16, 2010. Both the regular Core i7 and the ExtremeEdition are advertised as five stars in the Intel Processor Rating.

    3

    http://en.wikipedia.org/wiki/X86http://en.wikipedia.org/wiki/Microprocessorhttp://en.wikipedia.org/wiki/Intelhttp://en.wikipedia.org/wiki/Intel_Celeronhttp://en.wikipedia.org/wiki/Intel_Corehttp://en.wikipedia.org/wiki/Intel_Core_2http://en.wikipedia.org/wiki/Megabytehttp://en.wikipedia.org/wiki/Multi-chip_modulehttp://en.wikipedia.org/wiki/Lynnfield_(microprocessor)http://en.wikipedia.org/wiki/Clarksfield_(microprocessor)http://en.wikipedia.org/wiki/Arrandale_(microprocessor)http://en.wikipedia.org/wiki/Gulftown_(microprocessor)http://en.wikipedia.org/w/index.php?title=Intel_Processor_Rating&action=edit&redlink=1http://en.wikipedia.org/wiki/X86http://en.wikipedia.org/wiki/Microprocessorhttp://en.wikipedia.org/wiki/Intelhttp://en.wikipedia.org/wiki/Intel_Celeronhttp://en.wikipedia.org/wiki/Intel_Corehttp://en.wikipedia.org/wiki/Intel_Core_2http://en.wikipedia.org/wiki/Megabytehttp://en.wikipedia.org/wiki/Multi-chip_modulehttp://en.wikipedia.org/wiki/Lynnfield_(microprocessor)http://en.wikipedia.org/wiki/Clarksfield_(microprocessor)http://en.wikipedia.org/wiki/Arrandale_(microprocessor)http://en.wikipedia.org/wiki/Gulftown_(microprocessor)http://en.wikipedia.org/w/index.php?title=Intel_Processor_Rating&action=edit&redlink=1
  • 8/6/2019 Unit-III Telugu Ack

    4/46

    3.2 The Intel 8085 Microprocessor

    Intel 8085A is a single chip 8-bit N-channel microprocessor which works at +5V DCpower supply. It is a 40 pin IC available as a DIP (Dual Inline Package) chip. 8085A canoperate with a 3MHZ single phase clock and 8085A-2 version can operate at a maximumfrequency of 5MHZ. This 8085 is an enhanced version of its predecessor the 8080A. Itsinstruction set is upward compatible with that of the 8080A. 8085A has an on-chip clockgenerator with external crystal, LC or RC network. This 8085 microprocessor is built with

    nearly 6200 transistors. The enhanced version of 8080a is the Intel 8085AH. It is an Nchannel depletion load, silicon gate (HMOS) 8-bit processor. Here 3MHZ, 5MHZ and 6MHZselections are available. It has 20% lower power consumption than 8085A for 3MHZand5MHZ. Its instruction set is 100% software compatible with the 8085A. It is also 100%compatible with 8085A.

    3.3 Central Processing Unit (CPU)

    The Central Processing Unit of any microcomputer is the microprocessor. Hencemicroprocessor is also known as the heart of the computer. The CPU performs the variousactivities in response to set of instructions called a program. Programs are stored in the

    memory. The CPU reads in data control signals (instructions) through the input ports andexecutes one instruction at a time.

    So, generally speaking, a microprocessor Is nothing but the CPU the Intel 8085 CPUis an 8-bit device with a clock speed of 3-5 MHZ. It has 80 basic instructions and 146opcodes. Its clock cycle is 320 ns. The time for the clock cycle of Intel 8085 is 200 ns. Theblock diagram of 8085 is shown in Fig 3.1.. The 8085 CPU consists of three major sections,

    They are: (i) Arithmetic and logic unit (ALU)(ii) Registers(iii)Timing and Control unit.

    3.3.1 Arithmetic and logic unit (ALU): The ALU performs all the arithmetic and logical operations

    like addition, subtraction, complementing, logical AND, logical OR, logical Exclusive OR,incrementing and decrementing, rotate, shift and clear. An ALU is made of many logic gatesand adders etc.

    The arithmetic and logic unit consists of the following units:(a).Accumulator (A).(b).Temporary register.(c).Flag register.

    (a).Accumulator (A): It is an 8-bit register which is treated as a special function register. Most ofthe arithmetic and logic operations are performed using the accumulator. All the I/O datatransfers between 8085 and I/O devices are performed via accumulator. One of the operandsfor arithmetic operations in ALU is from the accumulator. After performing the arithmeticoperations the result is stored back in accumulator. It is from the accumulator only, the datais sent out to an output device. Similarly. The data from an input device is read only throughthe accumulator. The data in the accumulator alone can be rotated or shifted. No otherregister can be used for these operations. Certain instructions like DAA are performed usingonly accumulator. So, many times the Accumulator register is treated as a default register.

    (b).Temporary register: This is 8-bit register which is not accessible to the user. This register isused by the microprocessor to load the second operand during arithmetic/logical operations

    in ALU. The final result is stored in the Accumulator and the flags are set or reset accordingto the result of the operation. For example when MVI M, 17H instruction is fetched, IRregister will receive the opcode for MVI M and the Temporary register will receive 34H.

    4

  • 8/6/2019 Unit-III Telugu Ack

    5/46

    In arithmetic and logical operations, that involves two operands. The accumulatorprovides one operand. And the other is provided by the temporary register. For example inADD C instruction C register

    contents are moved to the Temp. Register and the addition of A and Temp. Register contents isperformed by the ALU.

    (c).Flag register: The flag register is an 8- bit register which generally reflect data conditions inthe accumulator with certain exceptions. Hence this flag register is also known as statusregister. Through this flag register is an eight bit register, it contains only 5 flag bits and the

    remaining three bits are undefined as shown below. In the Flag register each flag bit is a Flip-Flop. i.e., the bit may be either in the flip state or flop state

    S - Sign Flag: After execution of an arithmetic and logic operation, if bit D 7 of the result (Normallyin the Accumulator) is 1, the sign flag is set. This Flag is used with signed numbers.

    For example in a given byte, if D7 is 1, the number is treated as a negative number. Else (ifit is zero), it is viewed as a positive.

    In arithmetic operations with signed numbers bit D7is reserved for indicating the sign andthe remaining seven bits are used to denote the magnitude of the number.

    Z - Zero Flag: This Flag is set (made 1) if the result after any arithmetic operation is zero, and theflag is reset (made 0) if the result is not zero. So, this flag is set or reset based on the resultsin the accumulator as well as in the other registers.

    AC Auxiliary carry Flag: In this arithmetic operation, when a carry is generated by and passedon to bit bit4, the AC flag is set. This flag is used internally for BCD arithmetic and is notavailable for the programmer to change the sequence of a program with a jump instruction.

    But the Z and CY flags can be used for this purpose.

    Parity Flag: If the result after an arithmetic and logical operation has an even number of 1s, thisparity flag is set to 1 otherwise (if number of 1s is odd) the flag is reset (made0).

    For example the data byte 10111101 has even parity and the data byte 10011011 has odd parity.So P bit=0.

    CY-Carry flag: After an arithmetic operation, like addition, subtraction if there exists a carry orbarrow, this flag CY is set to 1 else it is reset (made0)

    Example: Let us consider the addition of two binary numbers 11011001 and 11101101 and checkthe Flag register. D7 D0

    1 1 0 1 1 0 0 11 1 1 0 1 1 0 1

    In the result, the sum is not zero, So Z-Flag is reset (Z=0).

    5

  • 8/6/2019 Unit-III Telugu Ack

    6/46

    There is a carry from the third bit to fourth bit. So AC Flag is set (AC=1).The D7 bit=1, so, the sign Flag is set (S=1).In the result, the no. of 1s is even. So, parity is even (P=1).After addition, there is a carry. So carry Flag is set (CY=1).Therefore the Flag register contents after addition are as shown below

    1 0 X 1 X 1 X 1

    6

  • 8/6/2019 Unit-III Telugu Ack

    7/46

    3.3.2 Timing and control Unit: This unit of the microprocessor issues necessary timing andcontrol signals for the execution of instructions. It generates three types of signals namelystatus, control and timing signals required for the operation of memory and I/O devices. Thisunit with the help of these signals controls the entire operation of the microprocessor and the

    peripherals. The signals associated with this unit are two control signals. and these

    status signals IO/ , S1 and S0 to identify the nature of the operation, and one special signal

    ALE which indicates the starting of the operation. These signals are explained below.

    -Read (active low): This is a Read control signal. This signal indicates that the selected I/O

    or memory device is to be read and data are available on the data bus.

    - Write (active low): This is a Write control signal. This signal indicates that the data on the

    data bus are to be written into a selected memory or I/O device.

    IO/ : This is a status signal used to differentiate between I/O and memory operations. When this

    signal is high, it indicates an I/O operation, when it is low it denotes a memory operation. This

    signal is combined with Read ( ) and Write to generate necessary I/O and memory

    control signals.

    S1 and S0 : These signals are also status signals like IO/ , used to identify various operations.

    The complete operation of the microprocessor can be understood by these three signals. Thevarious operations and the associated status signals are given in Table 3. .

    ALE Address Latch Enable: This is a positive going pulse generated every time the 8085begins an operation, It indicates that the bits on AD7 - AD0 are address bits. This signal isused primarily to latch the low-order address from the multiplexed bus and generate a set ofeight address lines A7 A0.

    S. No IO/ S1 S0 Status

    1

    2

    345

    6789

    0

    0111/01

    ***

    0

    10111

    0XX

    0

    0

    1

    0

    11

    0

    XX

    Memory Write

    Memory ReadI/O WriteI/O ReadOpcode fetchInterrupt

    AcknowledgeHaltHoldReset

    7

  • 8/6/2019 Unit-III Telugu Ack

    8/46

    Table3. Status signal of 8085

    3.3.3 Register Organization:

    The 8085 microprocessor has different types of registers. It includes six 8 bit registers(B,C,D.E,H and L), one 8-bit Accumulator and two 16-bit registers (SP and PC). In additionthere are two 8-bot temporary registers W and Z. Among these registers W and Z are not

    accessible to user, They are used by the processor for internal, intermediate operations. Theremaining registers are accessible to the user. The organization of 8085 registers is shown inFig 3. .

    The various registers of 8085 are classified into three types. They are(i) Temporary registers.(ii)General purpose registers(iii)Special purpose registers.

    (i) Temporary registers: The (i) Temporary registers are Temporary data registers, W registerand Z register. All are 8-bit registers. The Temporary data register is associated with the ALUoperations. One of the operand is stored in this register. This will not accessed by the user.

    Similarly W and Z are also temporary registers used to hold 8-bot data during execution ofcertain instructions, As these registers are internally used by the CPU, they are notaccessible to the user.

    The W and Z registers are used by the processor during CALL instruction. When a CALLinstruction is encountered in any program, the current program counter (PC) contents arepushed on to the stack and the given address is loaded on to PC. The given address istemporarily stored in W and Z registers and placed on the bus for the fetch cycle. Thus theprogram control is transferred to the address given in the instruction.

    Another example is during the execution of XCHG instruction, the contents of H-L pair areexchanged with D-E pair. At the time of exchange W and Z registers are used for temporarystorage of data.

    (ii)General purpose registers: B, C, D, E, H and L are six, 8-bit general purpose registers to storedata. These registers can be used as separate 8-bit registers and also can be paired as 16-bit registers to store the address of a memory location. But they must be paired as B-C; D-Eand H-L register pairs only as shown

    8

  • 8/6/2019 Unit-III Telugu Ack

    9/46

    When used as pair, In example B-C, the higher order byte moves to the first register (B) and the

    low order byte moves to the second register (C). the HL pair also functions as a data pointeror memory pointer

    For Ex: LXI H, 8500 H.This will load immediately the address of memory location (8500) in to H-L pair is now the H-L

    pair points to the location 8500 H.

    (iii)Special purpose registers: The Special purpose registers as their name indicates, are used for

    some specific purpose. The Special purpose registers are Accumulator (A), Flag Register,Instruction Register, Program Counter (PC) and Stack Pointer (SP).

    Accumulator (Register A): It is an 8-bit tristate register. It is mainly used for arithmetic, logic, loadand store operations. It is also used in I/O operations. In most of operations, the result isstored in Accumulator after execution.

    Flag Register: It is an 8-bit register. Which consists of only five flags, each flag bit is a flip flopthat indicates either a set or reset state. The five flags are Sign, Zero, Auxiliary carry, Parityand Carry as shown below

    Here X means undefined.Sign Flag: The sign flag is set to1 if the most significant bit of the result of an arithmetic or logoc

    operations is 1. Else it is reset (0).

    Zero Flag: The Zero status flag is set to 1 if the result of an arithmetic or logic operation is ZeroFor non-Zero result it is reset to 0.

    Auxiliary carry Flag: This flag is set if there is a carry from 3 rd bit to 4th bit during BCD operations(carry from lower nibble to higher nibble). This flag is not accessible to the user.

    Parity Flag: Parity is defined by the number of 1s present in a binary number stored in A register.After any arithmetic or logical operation, if the result has even number of 1s it is called evenparity and the Parity Flag is set to 1. Otherwise. i.e. If there is odd number of 1s in the result,it is called Odd Parity and the Parity flag is set 0.

    Instruction Register: It is an 8-bit register, which is a part of ALU. When an instruction is fetchedfrom memory, it is loaded in the Instruction Register. This register holds the instruction unit itis decoded by the Decoder. The instruction register is not programmable and cannot beaccessed through any instruction.

    9

  • 8/6/2019 Unit-III Telugu Ack

    10/46

    Program Counter (PC): It is a 16-bit special purpose register, which stores the address of thenext instruction to be fetched or executed. The execution of a program is initiated by loadingthe PC by the address of the first instruction of the program. Once the first instruction isexecuted, the PC is automatically incremented to point to the next instruction unless a jumpto some specific address is necessary. This process is repeated till the last instruction of theprogram.

    In case of JUMP or CALL instructions is stored in the Program Counter. The processorthen fetches the next instruction from the new address specified by the JUMP or CALL

    instruction. In conditional JUMP and conditional CALL instruction, if the condition is notsatisfied, the processor increments the Program Counter by three so that it points theinstruction followed by the conditional JUMP or CALL instruction, otherwise processorfetches the next instruction from the new address specified by JUMP or CALL instruction.

    Stack Pointer (SP): It is a 16-bit special purpose register which always stores the top address ofthe Stack. i.e. it always points to top of the Stack. Stack is a part of the memory location usedto store the data temporarily. A stack works on Last in First out (LIFO) basis. As the Stackpointer always points to the top of the Stack, only top of the Stack of the memory can beaccessed. When a Write operation (PUSH) takes place, the contents of the stack pointer isdecremented by two so that the SP points to the new location. Similarly when the Read

    operation (POP) occurs, the Stack pointer is incremented by two to point to the next data ontop of the Stack.

    The Stack Pointer is initialized by load register pair immediate instruction.LXI SP, 8530

    Here 8530 is the 16 bit address of the top of Stack location.

    The remaining blocks of 8085 microprocessor block diagram are explained below.

    Instruction Register and Decoder:

    The instruction register and the decoder are also part of the ALU. When an instructionis fetched from memory, it is loaded in the instruction register. The Decoder decodes theinstruction and develops the sequence of events to follow. The instruction register is a 8 bitspecial register, but it is not a programmable and is not accessible to the user. He instructionat a binary level and sends the appropriate signals to the control unit.

    Increment/ Decrement Address Latch:

    This is a 16 bit special register not accessible to the user. This register is used by theCPU to increment/ decrement the contents of the Stack Pointer (SP) and increment programcounter (PC) during instruction execution. During first T - state of op code fetch machinecycle (T1) the micro processor increments the PC register contents to point to the nextlocation. This increment operation takes place on increment/ decrement register addresslatch. The 16 bit address that is sent out through AD0-AD7 and A8-A15 are latched into thisregister. The address bus AD0-AD7 continues to be available on the bus after T 1 state fromthis latch.

    Address Buffer:

    This is an 8-bit unidirectional buffer. It is used to drive external higher order address bus. It

    is also used to tri-state the higher order address (A8-A15) bus under certain conditions likereset, hold, and halt and also when address lines are not in use.

    Address/Data Buffer:

    10

  • 8/6/2019 Unit-III Telugu Ack

    11/46

    This is an 8-bit bi-directional buffer. It is used to drive multiplexed address/data bus. Itmeans low order address bus(A7-A0) and data bus (D7-D0). It is also used to tri-state themultiplexed address/data bus under certain conditions like reset, hold, and halt and alsowhen data lines are not in use.The address and data bus buffers are used to drive external address and data busesrespectively. Due to these buffers the address and data buffers can be tri-stated when theyare not in use. In actual practice, in a microprocessor the driving capacity of the addresspins after the internal buffering may not be adequate. So, there will be external buffer chips

    also available.

    Serial I/O control:

    This control provides, two lines SOD (Serial Out Data) and SID (serial In Data) for serialcommunication. These lines are used during serial data transmission over long distancewhere data is transmitted and received bit by bit. The Serial Output Data (SOD) pin is usedto send data serially and serial Input Data (SID) pin is used to receive data serially by the8085 microprocessor.

    Interrupt control:This is an important block related to interrupts. This block is linked to the CPU through the 8-

    bit internal data bus. This interrupt control has five interrupt signals. They are TRAP, RST7.5, RST 6.5, RST 5.5 and INTR. The control block will take care of enabling and disabling ofthese interrupts etc

    3.4 Address, Data and Control Buses:

    Intel 8085 has 16-bit unidirectional address bus which carries the address of memoriesand peripheral devices. A bus is nothing but a group of electrical lines used to transmit theinformation as electrical signals. So, this 16-bit parallel address bus carries address frommicroprocessor to memories/peripherals. Hence it is Uni-directional. The width of the parallelbus determines now much memory that a microprocessor can address, the 8085

    microprocessor with 16-bit address bus can address a maximum of 216= 65536=64 KB ofmemory locations. The size of the address bus is independent of the size of themicroprocessor.

    In INTELL 8085 microprocessor, the 8 most significant bits of the address aretransmitted by the high order address bus A8-A15. But the 8 least significant bits of theaddresses are transmitted by Address/Data bus or A/D bus. i.e. the lower order address linesare multiplexed with the data bus. So, the AD bus operates in a time shared mode. i.e. thedata and address are sent on the same lines but at different instants of time. A0-A7 willalways have the address during the first T state (T1) of the machine cycle. To Demultiplexedthe AD bus the pin ALE is used. When ALE=1 (high) the AD bus acts as a lower orderaddress bus else it acts as Data bus.

    The Data bus is a bidirectional bus which is used to send data to and from themicroprocessor. This is also a parallel bus. The size of the data bus determines the size ofthe microprocessor. The 8085 microprocessor has 8-bit data bus and hence it is called an 8-bit microprocessor. This refers to the width of the data bus but not the address bus.Similarly8086 is a 16-bit microprocessor and its data bus width is 16 bits

    INTEL 8085 has Address/ Data bus namely AD7-AD0. i.e. at some instances it acts as a8- bit address bus and at other instances it works as a 8-bit data bus. INTEL used this timemultiplexing technique to save the pins. Generally the size of the internal general purposeregisters matches the size of the data bus

    Thus, the INTELs 8-bit general purpose registers matches with its 8-bit data bus. The size of the

    internal registers. So that all the bits on the bus can at one time come into or go out of any ofthe registers.

    11

  • 8/6/2019 Unit-III Telugu Ack

    12/46

    The control bus of 8085 is a uni-directional bus because the microprocessor alone sendscontrol signals to memories or peripheral devices. The size of the control bus depends uponthe specific microprocessor. Typical control signals are Read or Write signals. It meanswhether the microprocessor operation is a read or writes and whether it is memory or I/Ooperation. In addition to this it includes state signals, and address latch enables. Amicroprocessor may also have certain additional control signals and such as interruptsignals, acknowledgement signals and hold signals. But they are not considered as part ofcontrol bus even through they take part in control of microprocessor based systems.

    The above three buses that interface the CPU to the system components are combinedlyknown as the

    System bus.

    3.5 Interrupt structure of 8085

    The 8085 microprocessor has five interrupts. They are TRAP, RST 7.5, RST 6.5, RST5.5 andINTR. Among all these interrupts TRAP has the highest priority and INTR (Interrupt) has thelowest priority. The TRAP is also a non maskable interrupt. The numbers succeeding theRST (7.5, 6.5, and 5.5) are related to the call location. The various interrupts, their locationsin the order of highest to lowest priority are given in Table 3. . Here RST means RESTART.

    Among these interrupts INTR is the only non-vector interrupt whereas the interrupts arevectored interrupts.

    TRAP: It is a non maskable interrupt with highest priority. It means that whenever the pin isactivated, the 8085 will always get interrupted even if the 8085 is in DI (Disable Interrupt)state. Trap input is both edge and level sensitive. So, the microprocessor is interrupted whenthe input is both edge and level sensitive. So, the microprocessor is interrupted when theinput pulse goes from low to high or when it remains high when interrupted, themicroprocessor loads the program counter with 0024H.

    RST 7.5: It is an edge sensitive pin, Internal to 8085 there is a flip-flop connected to RST 7.5

    interrupt pin . This flip flop is set 1, when a positive going edge occurs on RST 7.5 input.RST 7.5 interrupt has a higher

    priority than RST 6.5, RST 5.5 and INTR. This RST 7.5 is a maskable interrupt known as MI. Thisinterrupt is enabled under program control with two instructions EI (Enable Interrupt) and SIM(Set Interrupt Mask)

    RST 6.5and RST 5.5: These interrupts level sensitive, it means the triggering level should be onuntil the microprocessor completes the execution of the current instruction. If themicroprocessor is not able to respond to the requests immediately, they should be stored orheld by external hardware. These two interrupts are also maskable interrupts. RST 6.5 andRST 5.5 have higher priority than INTR interrupt. The condition of these interrupts can beknown using RIM (Read Interrupt Mask) instruction and the condition of the masking interruptcan be set and reset using SIM instruction (Set Interrupt Mask).

    12

  • 8/6/2019 Unit-III Telugu Ack

    13/46

    INTR: It is only non-vectored interrupt in 8085 microprocessor. This interrupt has the lowestpriority among all the interrupts. This is also a maskable interrupt and can be disabled usingthe instruction DI (Disable Interrupt). The mask on INTR can be removed by executing EI(Enable Interrupt) instruction. When EI instruction is executed, the flip flop associated withthis is set and the mask is removed. This is a non-vectored interrupt because when theremaining interrupts are initialized, they are automatically transferred (vectored) to specificlocations on memory page 00H without any external hardware. They do not require the

    signal. The necessary hardware is already implemented inside the 8085. But coming

    to INTR, interrupt, it executes interrupt acknowledge machine cycle. During this cycle, the

    device that has interrupted this microprocessor will provide the operation code. The

    signal works as a signal during acknowledge machine cycle. During this time, the

    microprocessor loads the code into instruction register from I/O device. Based on the code,the remaining operation is executed by the processor

    S.N o Interrupts Call locations

    1

    2

    3

    4

    5

    TRAP (Top priority)

    RST 7.5

    RST 6.5

    RST 5.5

    INTR (least priority)

    0024H

    (7.5 x 8)H = 003CH

    (6.5 x 8)H = 0034H

    (5.5 x 8)H = 002CH

    No location

    13

  • 8/6/2019 Unit-III Telugu Ack

    14/46

    3.6 Pin configuration: The 8085 microprocessor is shown in Fig 3. . From the figure it is clear that it

    is 40 pin DIP chip. The various pins of 8085 microprocessor can be grouped in the following categories

    Power Supply and Clock pins

    Data bus and Address bus

    Control and Status signals

    Interrupt signals

    DMA signals

    Serial I/O signals

    The description of various pins is given below.

    Power supply and clock pins

    Vcc: +5V power supply

    Vss: Ground reference.

    X1 and X2: A Crystal (or RC, LC Network) is connected at these two pins. The internal clock

    generator divides oscillator frequency by 2, therefore to operate a system at 3MHZ, the crystal of

    the tuned circuit should have a frequency of 6MHZ.

    CLK (OUT): This signal is used as a system clock for other devices. Its frequency is half the

    oscillator frequencyData bus and Address bus:

    AD0-AD7: These lines are Address/Data lines, which are bidirectional with dual purpose. They are

    used as the low-order address bus as well as the data bus. During the first part of the machine cycle

    14

  • 8/6/2019 Unit-III Telugu Ack

    15/46

    (T1), lower 8 bits of memory address or I/O address appear on the bus. During the remaining part of

    the machine cycle (T2,T3) these lines are used as a bi-directional data bus.

    A8-A0: These are the upper half of the 16 bit address lines. These lines are exclusively used for the

    most significant 8 bits of the 16 bits of the16 bit address bus.

    Control and Status Signals:

    ALE (Address Latch Enable): This is a positive going pulse generated every time the 8085 beginsan operation. The ALE=High indicates that the bits on AD7-AD0 are address bits. This signal is

    mainly used to latch the low order address from the multiplexed bus and generate a separate set of

    eight address lines (A7-A0)

    (Read): This is an active low read control pin. This signal indicates that the selected I/O or

    memory device is to be read and data are available on data bus.

    (Write): This is an active low write control pin. It indicates that the data on the data on the

    data bus are to be are to be written into a selected memory or I/O location IO/ : This is a status signal used to differentiate between IO and memory operations. When it is

    high, it indicates an I/O operation and when it is low, it indicates a memory operation. This signal

    is combined with and signals to generate I/O and memory control signals.

    S1 and S0: These are status signals and they indicate the type of machine cycle in progress during

    execution of an instruction.

    READY(Input): Through this pin, the microprocessor will know whether peripheral device is

    ready or not for data transfer. If the device is not ready the processor waits. So, this pin helps tosynchronize slow devices to the microprocessor.

    Interrupt signals:

    TRAP, RST 7.5, RST 6.5, RST5.5 and INTR: These are the interrupt signals which are externally initiated.

    INTR (Interrupt Request): This is used as a general purpose interrupt. It has a lowest priority and it

    is the only non-vectored interrupt.

    RST 7.5: It is a restart interrupt pin. It has higher priority than RST 6.5, RST5.5 and INTR. It is a

    maskable vectored interrupt.

    RST 6.5 and RST5.5: These two are maskable vectored interrupt with higher priority than INTR.

    TRAP: It is a non-maskable vectored interrupt. It has higher priority.

    (Output): It is an active low interrupt acknowledge pin. This will acknowledge the receival of

    interrupt request to the peripheral device.

    DMA Signals:

    Hold: This pin is used during the Direct Memory Access. A high on this pin indicates that, a

    peripheral like DMA controller is requesting the use of address and data buses.

    HLDA (Output): A high on this p in acknowledges the hold request from peripheral.

    : It is an active low signal. When the signal on this pin goes low, the system is in reset i.e.

    the program counter is set to zero, the address & data buses are tristated.

    15

  • 8/6/2019 Unit-III Telugu Ack

    16/46

    RESETOUT: This signal is used to Reset other devices in microprocessor system.

    Serial input/ Output signals:

    SID: Serial input Data is a pin through which serial data are brought into the micro processor

    accumulator after the RIM instruction is executed.

    SOD: Serial output Data pin is used by the microprocessor to output data serially to the external

    devices. Serial data is sent out of the microprocessor by executing SIM instruction. The mostsignificant bit of accumulator should have the serial bit and D6 bit of the accumulator must be made

    high to enable the serial data transfer.

    Stack and Subroutines: Stack is a set of memory locations in the Read/Write memory which is

    used for temporary storage of binary information during the execution of a program. It is

    implemented in the Last-in-first-out (LIFO) manner. i.e., the data can be written first can be

    accessed last, one can put the data on the top of the stack by a special operation known as PUSH.

    Data can be read or taken out from the top of the stack by another special operation known as

    POP.

    Stack is implemented in two ways. In the first case, a set of registers is arranging in a shift

    register organization. One can PUSH or POP data from the top register. The whole block of data

    moves up or down as a result of push and pop operations respectively. In the second case, A block

    of RAM area is allocated to the stack. A special purpose register known as stack pointer (SP)

    16

  • 8/6/2019 Unit-III Telugu Ack

    17/46

    points to the top of the stack. Whenever the stack is empty, it points to the bottom address. If a

    PUSH operation is performed, the data are stored at the location pointed to by SP and it is

    decremented by one. Similarly if the POP operation is performed, the data are taken out of the

    location pointed at by SP and SP is incremented by one. In this case the data do not move but SP

    is incremented or decremented as a result of push pop operations respectively.

    Application of Stack: Stack provides a powerful data structure which has applications in many

    situations. The main advantage of the stack is that,

    1. We can store data (PUSH) in it with out destroying previously stored data. This is not true

    in the case of other registers and memory locations.

    2. stack operations are also very fast

    3. The stack may also be used for storing local; variables of subroutine and for the transfer of

    parameter addresses to a subroutine. This facilities the implementation of re-entrant

    subroutines which is a very important software property.

    The disadvantage is, as the stack has no fixed address, it is difficult to debug and document a

    program that uses stack.

    Stack operation: Operations on stack are performed using the two instructions namely PUSH andPOP. The contents of the stack are moved to certain memory locations after PUSHinstruction. Similarly, the contents of the memory are transferred back to registers by POPinstruction.

    For example let us consider a Stack top is 4506 H. This is stored in the 16-bit Stackpointer register

    Let us consider two registers (register pair)

    B & C whose contents are 25 & 62.

    Reg. B Reg. C

    25 62

    17

  • 8/6/2019 Unit-III Telugu Ack

    18/46

    After PUSH operation the status of the Stack is as shown below

    Let us now consider POP operation.

    18

  • 8/6/2019 Unit-III Telugu Ack

    19/46

    Programming Example:

    1. Write a program to initialize the stack pointer (SP) and store the contents of the register pair

    H-L on stack by using PUSH instruction. Use the contents of the register pair for delay counter

    and at the end of the delay retrieve the contents of H-L using POP.

    Program:

    MemoryLocation

    Label Mnemonics Operand Comment

    8000

    8003

    80068007

    ||

    800A

    LXI

    LXI

    PUSH

    DELAY

    POP

    SP, 4506 H

    H,2565 H

    H

    CALL

    H

    Initialize Stackpointer

    Push thecontents.

    19

  • 8/6/2019 Unit-III Telugu Ack

    20/46

    Subroutine: It I a set of instructions written separately from the main program to execute afunction that occurs repeatedly in the main program.

    For example, let us assume that a delay is needed three times in a program. Writingdelay programs for three times in a main program is nothing but repetition. So, we can write asubroutine program called delay and can be called any number of times we need.

    Similarly, in 8085 microprocessor we do not find the instructions for multiplication anddivision. For this purpose we write separate programs. So, in any main program if these

    operations are needed more than once, the entire program will become lengthy and complex.So, we write subroutine programs MUL & DIV separately from main program and use theinstruction CALL MUL (or) CALL DIV in the main program. This can be done any number oftimes. At the end of every subroutine program there must be an instruction called RET. Thiswill take the control back to main program.

    The 8085 microprocessor has two instructions to implement the subroutines. They areCALL and RET. The CALL instruction is used in the main program to call a subroutine andRET instruction is used at the end of the subroutine to return to the main program. When asubroutine is called, the contents of the Program Counter, which is the address of theinstruction following the CALL instruction is stored on the stack and the program execution istransferred to the subroutine address. When the RET instruction is executed at the end of the

    subroutine, the memory address stored on the stack is retrieved and the sequence ofexecution is resumed in the main program.

    Diagrammatic representation:Let us assume that the execution main program started at 8000 H. It continues

    until a CALL subroutine instruction at 8020 H. Then the program execution transfers to 8070H. At the end of the subroutine 807B H. The RET instruction is present. After executing thisRET, it comes back to main program at 8021 H as shown in the following figure.

    The same is shown by the assembly language program example.

    Program Example:

    20

  • 8/6/2019 Unit-III Telugu Ack

    21/46

    Subroutine Program:

    Memory

    Address

    Mnemonics Operand Comments

    8070|

    ||

    |807B

    807C

    807F

    Instructions

    RET

    Next Subroutine

    RET

    Beginning of the Subroutine.

    End of the program

    Instructions of next subroutine ifany

    End of the subroutine.

    MemoryAddress

    Mnemonics Operand Comments

    8000|||

    8020

    802180228023

    |||

    802F

    LXJ

    CALL

    Next instruction|||

    HLT

    SP, 8400 H

    8070 H

    Initialize the Stack pointer at 8400 H

    Call a subroutine program stored at the

    location 8070 H. (It is a three byInstruction)The address of the next instructionfollowing CALL instruction.

    End of the main program.

    21

  • 8/6/2019 Unit-III Telugu Ack

    22/46

    22

  • 8/6/2019 Unit-III Telugu Ack

    23/46

    23

  • 8/6/2019 Unit-III Telugu Ack

    24/46

    24

  • 8/6/2019 Unit-III Telugu Ack

    25/46

    INSTRUCTION CYCLE:An instruction is a command given to the microprocessor to perform a specific operation on thegiven data. Sequence of instructions written for a processor to perform a particular task is calleda program. Program & data are stored in the memory. The microprocessor fetches one

    instruction from the memory at a time & executes it. It executes all the instructions of the programone by one to produce the final result. The necessary steps that a microprocessor carries out tofetch an instruction & necessary data from the memory & to execute it constitute an instructioncycle.In other words, an instruction cycle is defined as the time required completing theexecution of an instruction.An instruction cycle consists of a fetch cycle and an execute cycle. The time required to fetch anopcode (fetch cycle) is a fixed slot of time while the time required to execute an instruction(execute cycle) is variable which depends on the type of instruction to be executed.

    Instruction cycle(IC) = Fetch cycle(FC) + Execute cycle(EC)

    This is shown diagrammatically below.

    FETCH OPERATION:

    The first byte of an instruction is its opcode. An instruction may be more than one byte long. Theother bytes are data of operand address. The program counter (PC) keeps the memory addressof the next instruction to be executed. In the beginning of a fetch cycle the content of the programcounter, which is the address of the memory location where opcode is available, is sent to thememory. The memory places the opcode on the data bus so as to transfer it to themicroprocessor. The entire operation of fetching an opcode takes three clock cycles.EXECUTE OPERATION:The opcode fetched from the memory goes to the instruction register (IR). From the instructionregister it goes to the decoder circuitry which decodes the instruction. After the instruction isdecoded, execution begins. If the operand is in general purpose registers execution isimmediately performed.

    The time taken for decoding and execution is one clock cycle. If an instruction contains data oroperand and address which are still in the memory, the microprocessor has to perform someread operations to get the desired data. After receiving the data it performs execute operation. Aread cycle is similar to a fetch cycle. In case of a read cycle the quantity received from thememory are data or operand address instead of an opcode. In some instructions write operationis performed. In write cycle data are sent from the microprocessor to the memory or an outputdevice. Thus we see that in some cases an execute cycle may involve one or more read or writecycles or both.

    MACHINE CYCLE:

    Machine cycle is defined as the time required for completing the operation of accessing eithermemory or I/O. In the 8085, the machine cycle may consist of three to six T states. The T-stateis defined as one sub-division of the operation performed in one clock period. These sub-divisions are internal states synchronized with the system clock.

    25

  • 8/6/2019 Unit-III Telugu Ack

    26/46

    Timing Diagram for Memory Read Machine Cycle

    Timing Diagram for Opcode Fetch Machine Cycle.

    26

  • 8/6/2019 Unit-III Telugu Ack

    27/46

    Timing Diagram for I/O Read Machine Cycle

    27

  • 8/6/2019 Unit-III Telugu Ack

    28/46

    Timing Diagram for Memory Write Machine Cycle

    28

  • 8/6/2019 Unit-III Telugu Ack

    29/46

    Timing Diagram for I/O Write Machine Cycle

    29

  • 8/6/2019 Unit-III Telugu Ack

    30/46

    30

  • 8/6/2019 Unit-III Telugu Ack

    31/46

    ALGORITHMS

    The step by step procedure written in detail without computer commands in a simple language(normally English) to solve a given problem is known as Algorithm. For this, first the givenproblem is divided into small steps in terms of the operations the 8085 can perform (calledmodules) without using the instructions. Finally the modules are added to develop thecomplete program.The Important characteristics of the algorithms are (i) Algorithms are welldefined.(ii) Algorithms produce a specific result (iii) Every algorithm terminates in a finite

    number of steps.Advantages of Algorithms : i) Algorithms are independent of any computer language. ii)

    Algorithms are easy to follow by any one who reads. iii) Useful to debug the program , sinceevery step has got its own logical sequence. iv) Algorithms can be easily converted intoflowcharts and then into computer programs.

    FLOWCHARTS

    The most common way of representing the sequence of steps of a program in a pictorial formatis known as flow chart.The First flowchart was made by John Von Newman in 1945.Theflowchart is used for two purposes.One is to help the reader to under stand the logic and

    objective of any program and the other is to debug the program easily if the expected resultis not achieved..The below figures shows the commonly used flow chart symbols.

    31

  • 8/6/2019 Unit-III Telugu Ack

    32/46

    32

  • 8/6/2019 Unit-III Telugu Ack

    33/46

    Differences between static and dynamic RAMs:

    Static RAM Dynamic RAM

    1. This semiconductor memory isconstructed using bipolar

    transistors

    2. Information is stored in the form

    of voltage levels in flip-flops

    3. These voltage levels do not get

    drifted away

    4. No refresh logic is needed

    5. Power is required even when the

    chip is in standby mode

    6. Four time larger in size compared

    to an equivalent dynamic cell

    1. This semiconductor memory isconstructed using MOS transistors

    2. Information is stored in the form of

    electrical charges in capacitors

    3. Has tendency of leakage

    4. Refresh logic is necessary since

    leakage of electrical charges

    5. Refresh login is inbuilt, so draws

    less power comparatively.

    6. Four times as many bits as a static

    RAM chip.

    33

  • 8/6/2019 Unit-III Telugu Ack

    34/46

    34

  • 8/6/2019 Unit-III Telugu Ack

    35/46

    35

  • 8/6/2019 Unit-III Telugu Ack

    36/46

    36

  • 8/6/2019 Unit-III Telugu Ack

    37/46

    37

  • 8/6/2019 Unit-III Telugu Ack

    38/46

    38

  • 8/6/2019 Unit-III Telugu Ack

    39/46

    39

  • 8/6/2019 Unit-III Telugu Ack

    40/46

    40

  • 8/6/2019 Unit-III Telugu Ack

    41/46

    41

  • 8/6/2019 Unit-III Telugu Ack

    42/46

    42

  • 8/6/2019 Unit-III Telugu Ack

    43/46

    43

  • 8/6/2019 Unit-III Telugu Ack

    44/46

    44

  • 8/6/2019 Unit-III Telugu Ack

    45/46

    45

  • 8/6/2019 Unit-III Telugu Ack

    46/46