mpmc-unit-i

28
UNIT-1 INTRODUCTION The microprocessor is a programmable integrated device that has computing and decision-making capability similar to that of the Central Processing Unit (CPU) of the computer. The microprocessor communicates and operates in the binary numbers 0 and 1, called bits. Each microprocessor has a fixed set of instructions in the form of binary patterns called a machine language. The binary instructions are given abbreviated names, called mnemonics, which form the assembly language for a given microprocessor. Because an assembly language is specific to a given machine, programs written in assembly language are not transferable from one machine to another. Machine independent languages are called high-level languages. Microprocessor Definition A microprocessor is a multipurpose, multiprogrammable, clock driven, register based electronic device that reads binary instructions from a memory, accepts binary data as input, and processes data according to those instructions, and provides results as output. Microprocessor Based System A microprocessor is a microprocessor-based system that includes mainly three components as shown below. ҏ Microprocessor ҏ I/O ҏ Memory (RAM and ROM) Diagram:

Upload: sen-philip

Post on 04-Oct-2014

41 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: MPMC-UNIT-I

UNIT-1INTRODUCTION

Ø The microprocessor is a programmable integrated device that hascomputing and decision-making capability similar to that of theCentral Processing Unit (CPU) of the computer.

Ø The microprocessor communicates and operates in the binary numbers0 and 1, called bits.

Ø Each microprocessor has a fixed set of instructions in the form ofbinary patterns called a machine language.

Ø The binary instructions are given abbreviated names, calledmnemonics, which form the assembly language for a givenmicroprocessor. Because an assembly language is specific to a givenmachine, programs written in assembly language are not transferablefrom one machine to another. Machine independent languages arecalled high-level languages.

Microprocessor DefinitionA microprocessor is a multipurpose, multiprogrammable, clock driven,register based electronic device that reads binary instructions from amemory, accepts binary data as input, and processes data according to thoseinstructions, and provides results as output.

Microprocessor Based SystemA microprocessor is a microprocessor-based system that includes mainlythree components as shown below.

MicroprocessorI/OMemory (RAM and ROM)

Diagram:

Page 2: MPMC-UNIT-I

These components are organized around a common communication pathcalled bus.

Microprocessor:Ø It is a clock driven semiconductor device consisting of electronic logic

circuits.Ø It can be further divided into three segments as arithmetic logic unit,

register array and control unit.Ø Arithmetic Logic Unit – performs computing functions such as

addition, subtraction, and logical operations such as AND,OR, andEXOR.

Ø Register array – consists of various registers B, C, D, E, H and L.These are used to store data temporarily during the execution of a

Ø program. These are accessible to the user through instructions.Ø Control unit provides necessary timing and control signals to all the

operations in a microcomputer. Also, it controls the flow of data theØ various units.

Memory:Ø Store binary information as instructions, data, and provides the same

to the microprocessor when necessary.Ø Memory has two sections – Read/Write memory and Read Only

Memory.Ø ROM is used to store programs that do not need alterations such as

monitor programs. Programs stored in ROM can be only read.Ø Read/Write memory (R/WM) also called user memory stores user

programs and data. Programs can be read and altered

Page 3: MPMC-UNIT-I

Input/Output:Ø Helps to communicate with the outside world. Also called peripherals.

Ø Input devices such as keyboard, switches and analog to digital

Ø converters transfer binary information form user to microprocessor.

Ø Output devices transfer data from the microprocessor to the outsideworld. They include CRT, LEDs, a printer, a X-Y plotter, a magnetictape and digital to analog converters.

System bus:

Ø This is a communication path between the microprocessor andperipherals. They are a group of wires to carry bits.

Ø Microprocessor communicates with only one peripheral at a timethough all the peripherals share the same bus.

Ø The timing is provided by the control unit.

Advantages of microprocessor based systems:Ø Simplifies system design

Ø Reduces development time

Ø Reduces cost and size

Ø Flexible in operation.

Differences Between Microprocessor & Micro controller:Microprocessors contain no RAM, no ROM and no I/O ports on the chipitself. The addition of the external RAM, ROM, I/O ports and timersmake these systems bulkier and more expensive. But they have theadvantage of versatility. Where as a microcontroller has a microprocessor(which functions as a CPU), RAM, ROM, I.O ports and timers are on asingle chip.

Page 4: MPMC-UNIT-I

Microprocessor Working:The process of program execution is as follows.

The instructions are stored sequentially in memory.The microprocessor fetches the first instruction from the memory, decodes

and executes it.The sequence of fetch, decode, and execute is continued until the

microprocessor comes across an instruction ‘stop’.During the entire process, microprocessor uses the system bus to fetch

binary instructions, uses registers to store data temporarily, and performscomputing functions in ALU.

Microprocessor Operations:The functions performed by the microprocessor can be classified into threecategories._ Microprocessor initiated operation_ Internal operations_ Peripheral operations.

(i) Microprocessor Initiated Operations:The MPU performs four functions mainly_ Memory read_ Memory write_ I/O read_ I/O writeTo communicate with a peripheral or memory, MPU has to do the following

steps.Step1: Identify the peripheral or memory (using address)Step2: Transfer binary information (data and instructions)Step3: Provide timing and synchronization signals.

ii) Internal Data Operations:These operations includeStore 8 bit data, Perform arithmetic and logical functions, Test forconditions, Sequence the execution of instructions, Store data temporarily inthe defined R/WM during execution called stack, These are performed usingregisters, an ALU and control logic and internal buses.

(iii) Peripheral Or Externally Initiated Operations:

Page 5: MPMC-UNIT-I

External devices can initiate the pins on the microprocessor: Reset,Interrupt, Hold, and Ready.

Reset pin is activated when all the internal operations are suspended andthe PC is cleared.

Interrupt signal can interrupt a microprocessor to execute otherinstructions called service routine. The microprocessor resume itself aftercompleting the routine.

Ready pin when low makes a microprocessor to enter a wait state tosynchronize slow peripherals.

Hold pin when activated by an external signal, the microprocessorrelinquishes control of all the buses and allows a external peripheral touse them.

THE 8085 MPUThe MPU as a device or a group of devicesCan communicate with peripheralsProvide timing signalsDirect data flowPerform computing tasksThe 8085A is an 8- bit general-purpose microprocessor capable ofaddressing 64K of memory. The device has 40 pins, requires +5vsingle-phase supply, and can operate with a 3-MHz single phase clock.

ARCHITECTURE

Definition:The internal logic design of a microprocessor is called its architecture.Limitations of 8085 over MPU:A microprocessor can almost qualify a MPU but has two limitations._ The lower order address bus of 8085 microprocessor is multiplexed withthe data bus. These buses need to be de-multiplexed_ Appropriate control signals need to be generated to interface memory andI/O with 8085.

8085 Pin Configuration:8085 Pin out diagram

Page 6: MPMC-UNIT-I

_ The 8085 is a microprocessor with 8-bit word length and is an improvedversion of the earlier processor 8080A._ The 8085 includes on its chip most of the logic circuitry for performingcomputing tasks and for communicating with peripherals._ Eight of its bus lines are multiplexed; that is, they are time-shared by thelower-order address and data.

The 8085 MPU:

The MPU as a device or a group of devices_ Can communicate with peripherals_ Provide timing signals_ Direct data flow_ Perform computing tasksThe 8085A is an 8- bit general-purpose microprocessor capable ofaddressing 64K of memory. The device has 40 pins, requires +5vsingle phase supply, and can operate with a 3-MHz single phase clock.

The internal architecture of the 8085 includes

Page 7: MPMC-UNIT-I

1. Arithmetic/Logic Unit (ALU)2. Timing and Control Unit3. Instruction Register and Decoder4. Register Array5. Interrupt Control6. Serial I/O Control

The ALU:_ It includes the accumulator, the temporary registers, the arithmetic & logiccircuits, and five flags._ The result is stored in the accumulator, and the flags are set or resetaccording to the result of operationFlags:

There are five flip-flops that act as flags for testing data conditionsAffected by Arithmetic and logical Operations

The flags areS-Sign flag: Set - Bit D7 of the result (accumulator) is 1

Reset - Bit D7 of the result (accumulator) is 0Z-Zero flag: Set - Result of operation is 0

Reset - Result is nonzeroAC-Auxiliary Carry flag: Set -A carry from bit D3 to bit D4

Reset- No carry from bit D3 to bit D4P-Parity flag: Set - Result has even number of ones

Reset - Result has odd number of onesCY-Carry flag: Set - Final carry from the MSB

Reset -No carry out of MSB

Page 8: MPMC-UNIT-I
Page 9: MPMC-UNIT-I

Timing and Control Unit:_ Synchronizes all the microprocessor operations_ Generates necessary signals for communication between peripherals and p.

Instruction Register and Decoder:_ Loads the instructions from the memory_ The decoder decodes & a sequence is established.

Register Architecture:The 8085 has six general purpose registers namely

B, C, D, E, H and L.These registers are programmable.Used to load or copy data by writing instructions

Accumulator (Register A):8-bit registerUsed for performingArithmetic & Logic OperationsI/O data transfers between 8085 & I/O devices.

Program Counter:16-bit register, memory pointerUsed for sequencing the execution of instructionsAddress up to 16K of memory

Stack Pointer:16-bit register, memory pointerContains the address of the last data byte written into the stack

Page 10: MPMC-UNIT-I

Two additional registers called temporary registers (8-bit) W and Z, areincluded in the register array.

Pin Configuration:The 8085 is housed in a 40-pin dual in-line package (DIP). All the signalscan be classified into six groups:1. Address Bus2. Data Bus3. Control and Status signals4. Power supply and frequency signals5. Externally initiated signals6. Serial I/O ports

Address Bus:The 8085 has eight signal lines, A15-A8, which are unidirectional and usedas theHigher order address bus.8085 bus structure block diagram

8085 bus structure block diagram

System Buses:Address bus:

These are a group of 16 lines identified ad Ao to A15.The address bus is unidirectional – from MPU to peripheral devices.This is used to perform the first function – identifying a peripheral or a

memory location using their address.

Page 11: MPMC-UNIT-I

The number of address line is arbitrary based on the availability of pinsand intended applications.

Data bus :These are a group of eight lines used for data flow.These lines are bi-directional – data flow between MPU and memory and

peripherals.These are used to perform the second function – transferring binary

information.The largest number that can appear on the data bus is all 1s.8085 is called a 8 bit microprocessor as they have 8 data lines

Control bus:This is comprised of various single lines that carry synchronization

signals.These perform the third function – provide timing signals.These signals are used to identify a device type with which the MPU

intends to communicate.An example is memory read operation to read an instruction from a specifiedmemory location. The steps include:Address on the bus is decoded by an external logic circuit and the memorylocation is identified.The MPU sends a Memory readpulse as the control signal.The pulse activates the memory chip and the contents of the memorylocation are placed on the data bus and brought inside themicroprocessor.

Multiplexed Address/Data Bus:The signal lines AD7-AD0 are bi-directional: they serve dual purpose. Theyare used as low-order address bus as well as the data bus. But thebuses can be separated by a latch. The beginning of an instruction isindicated by the rising edge of the ALE (Address Latch) signal. At thefalling edge of ALE, support chips like 8155 or 8355 automatically latch thelow byte of address. The low-order address bus(AD0-7) of 8085microprocessor is multiplexed (time-shared) with the data bus. These linesare bi-directional. They need to be de-multiplexed to separate dataand address.

Page 12: MPMC-UNIT-I

Control and Status Signals:There are two control signals and three-status signal.

RD - Read: This is a Read control signal (active low). This signal indicatesthat the selected I/O or memory device is to be read and thedata are available on the data bus.

WR -Write: This is a Write control signal(active low) . This signalindicates that the data on the data bus are to be written into a selectedmemory or I/O location.

IO M - This is a status a signal used to differentiate between I/O andmemory operations. High-I/O operation; Low-Memory operation

S1 and S0- These status signals can identify various operations (similar toIO M ).

ALE- Address Latch Enable (Special signal) : This is used to latch thelow-order address from the multiplexed bus and generate separateset of eight address lines.ALE (address latch enable) is generated when 8085 begins a machine cycle,indicating that the bits on AD7-0 are address bits; It remainsHIGH only during one clock period and the address signals need to belatched. The RD signal goes LOW during IO or memory ReadOperation. TheWR signal goes LOW during IO or memory Write Operation.The IO M goes HIGH to indicate the execution of an I/Oinstruction like IN or OUT. It goes LOW during the execution of a memoryinstruction. The IO M , S0 and S1 are outputted by 8085 during itsinternal operations and are interpreted as follows:

Page 13: MPMC-UNIT-I

The RESET IN signal when pulsed LOW, causes 8085 to execute the 1stinstruction at 0000H location. It must be held LOW for at least three clockperiods. A HIGH on the RESET OUT resets the other chips connected tothis line.Power Supply:VCC: +5VVSS: ground ReferenceClock Frequency:X1, X2: A crystal is connected at these two pins. To operate a system at3MHz, the crystal should have a frequency of 6MHz.CLK (OUT)- Clock Output:The serial input data (SID) and serial output data (SOD) are associated with8085's serial I/O transfer. The SOD line can be utilized to output the mostsignificant bit of the accumulator. The SID can be used to input the SID pinto the most significant bit of the accumulator. The HOLD and HLDA signalsare used for the direct memory access (DMA) type of data transfer.Buffers/Drivers:The buffer/driver is a logic circuit that amplifies the current or power. It hasone input line and one output line. The logic level of the output is the sameas that of the input. The buffer is used primarily to increase drivingcapability of a logic circuit. In a tri-state buffer, when the enable line is Bactive, the circuit functions as a buffer; otherwise it stays in the high-impedance state. The buffer/driver are used to increase the drivingcapability of the data bus and the address bus. The octal buffer 74LS244 is atri-state buffer (also known as a line driver or line receiver). It is normallyused as a driver for the address bus in a bus-oriented system. The data bus ofa microcomputer system is bi-directional and 74LS245 is the octal bustransceiver which is commonly used as driver for the data-bus.Interrupts and Externally Initiated Signals:8085 has five interrupt signals that can be used to interrupt a programexecution the signals TRAP, RST7.5, RST6.5, RST5.5, INTR and INTAare related to the 8085 interrupt signals. TRAP is a non-maskable interruptand has the highest priority. RST 7.5, 6.5 and 5.5 are maskableinterrupts and their vector addresses are generated automatically.

Page 14: MPMC-UNIT-I

o INTR - Interrupt Request: Used as a general-purpose interrupto INTA - Interrupt Acknowledge: Used to the acknowledge the interrupto RST7.5, RST6.5, RST5.5 – Restart Interrupts: These are vectoredinterrupts that transfer the program control to specific memorylocations. These have higher priorities than INTR interrupt.o Among these three, the priority order is 7.5, 6.5 and 5.5o TRAP- This is a nonmaskable interrupt and has the highest priority.o HOLD – This signal indicates that a peripheral such as a DMA controlleris requesting the use of address and data buses.o HLDA – Hold Acknowledge: This signal acknowledges the HOLDrequest.o READY – This signal is used to delay the microprocessor Read or writecycles until a slow- responding peripheral is ready to send or accept data.When this signal goes low, the microprocessor waits for an integral numberof clock cycles until it goes high.In addition to the interrupts, three pins –RESET, HOLD, and READY –accept the externally initiated signals as inputs._ RESET IN : When the signal on this pin goes low, the program counter isset to Zero, the buses are tri-stated, and the MPU isreset._ RESET OUT: This signal indicates that the MPU is being reset. The signalcan be used to reset other devices.8085 Interrupt:The interrupt I/O is a process of data transfer whereby an external device ora peripheral can inform the processor that it is ready fro communication andrequests attention. This is an asynchronous process initiated externallywithout reference to the system clock. The 8085 interrupt process iscontrolled by the Interrupt enable flip-flop, which is internal to the processorand can be set/reset by software instructions.The 8085 interrupt process can be described in following steps.1. The interrupt process should be enabled by the instruction EI in the mainprogram.

2. When the microprocessor is executing a program, it checks the INTR lineduring the execution of each instruction.3. If the INTR is high and the interrupt is enabled, the microprocessorcompletes the current instruction, disables the interrupt enable flip-flop andsends a signal INTA – interrupt acknowledge (active low). The processorcannot accept any interrupt until the interrupt flip-flop is enabled again

Page 15: MPMC-UNIT-I

4. The signal INTA is used to insert a restart (RST) instruction or a callinstruction through external hardware.5. When the microprocessor receives a RST instruction, it saves the memoryaddress of the next instruction on the stack. The programis transferred to the CALL location.6. Assuming that the task to be performed is written as a subroutine (alsocalled service routine) at the specified location, the processorperforms the task.7. The service routine should include an EI instruction to enable the interruptagain.8. At the end of the subroutine, the RET instruction retrieves the memoryaddress where the program was interrupted and continues the execution.

8085 Vectored Interrupts:The 8085 have five vectored interrupts, INTR, RST 5.5, RST 6.5, RST 7.5and the fifth is called TRAP, a non-maskable interrupt. The last fourare automatically vectored (transferred) to specific locations on memorypage 00H without any external hardware. The TRAP has the highestpriority followed by RST 7.5, 6.5, 5.5 and INTR, but has a lower prioritythan HOLD signal.Triggering levels:TRAP – level and edge sensitive, RST 7.5 – positive edge sensitive, RST6.5, 5.5 – level sensitivePending Interrupts:Because there are several interrupt lines, when one interrupt is requested isbeing served, other interrupt requests may occur and remain pending. The8085 has an additional instruction called RIM (Read Interrupt Mask) tosense these pending interrupts.Serial I/O Ports:The 8085 has two signals to implement the serial transmission: SID (SerialInput Data) and SOD (Serial Output Data). Data transfer is controlledthrough the instructions: SIM and RIM.Serial Output Data: To output data serially from the SOD line, theinstruction SIM is necessary.MVI A, 80H ; Set D7 in the accumulator=1RAR ; Set D6 = 1 and bring carry into D7SIM ; Output D7In this set of instructions, the serial output line is enables by rotated 1 intobit position D6; the instruction SIM outputs the carry bit through bitposition D7 Serial Output Line (SOD)

Page 16: MPMC-UNIT-I

SDE - 1 = Enable SOD For Interrupts0 =DisableSODInterpretation of Accumulator Contents by the SIM instructionSerial Input Data:Instruction RIM is used to input serial data through the SID line. InstructionRI can be interpreted for serial I/O. In the context of serial I/O,instruction RIM is similar to instruction IN, except RIM reads only one bitand places it in the accumulator at D7.The SID and SOD lines in the 8085 eliminate the need for an input port andan output port in the software –controlled serial I/O. Essentially,SID is a 1-bit input port and SOD is 1-bit output port. Similarly, instructionRIM is equivalent to a 1-bit. IN instruction and instruction SIM isequivalent to a conditional 1-bit OUT instructionSerial Input DataInterrupt StatusInterpretation of Accumulator Contents after the RIM InstructionTiming Diagram:D7 D6 D5 D4 D3 D2 D1 D0D7 D6 D5 D4 D3 D2 D0Basic System Timing: Each instruction consists of one or more machinecycles, and each machine cycle is divided into T-states.Instruction Cycle: Time required to complete the execution of theinstruction. 8085’s instruction cycle consists of one to six machine cycles.Machine Cycle: Time required to complete one operation of accessingmemory, I/O, or acknowledging an external request. Consists of threeto six T-States.T-state: One subdivision of the operation performed in one clock period8085’s Timing Cycles:An 8085’s instruction’s execution consists of a number of machine cycles.Each machine cycle contains a number of clock periods or T-states.The first machine cycle will be executed by either four or six clock periodsand the machine cycles that follow will have three clock periods.8085’s Machine Cycle, T-State or Clock Periods:The shaded machine cycles/clock periods indicate that they are required onlyby certain instructions.The beginning of a new machine cycle is indicated by a HIGH ALE signal.ALE remains HIGH only during T1. During this time, lines AD7-0 containthe low byte of the address. When the ALE goes LOW, the low byte of theaddress should be latched so that the AD7-0 can be used for transferringdata.

Page 17: MPMC-UNIT-I

1.3.2 8085’s Timing Diagram, Instructions Fetch, Execute and Overlap:An instruction execution includes two operations:

Opcode fetch - Requires either four or six cycles.Decode and Execute Cycle.

MC1 MC2 MC3 MC4 MC5T1 T2 T3 T4 T5 T6 T1 T2 T3 T1 T2 T3 T1 T2 T3 T1 T2 T3

INSTRUCTION FORMATSInstruction Classification:An instruction is a binary pattern designed inside a microprocessor toperform a specific function. The entire set of instructions called theinstruction set determines what functions the microprocessor can perform.8085 is a byte addressable machine and it can directly address 64K(216) distinct memory locations. Two consecutive memory locations may beused to represent a 16-bit data item. By Intel convention, high-order byte ofa 16-bit data is always assigned to the high memory address.The 8085 p is designed to execute 74 different instructions types. The setof instructions written in a sequence is called a program.Instruction has two parts:_ Operation Code (Opcode): It is the task to be performed._ Operand: Data to be operated up on.The operand may be specified in various ways (8-bit, 16 bit, data from aregister, from a memory location) and in some instructions, the operand isimplicit.One-byte instruction:Includes the opcode and the operand in the same byte and each instructionrequires one memory location. Examples:Opcode & Operand Machine CodeADD B 80H (1000 0000); Add the contents of B to the Accumulator AMOV C, A4FH (0100 1111); Move A to CCMA 2FH (0010 1111); Complement each bit in the accumulator.

Page 18: MPMC-UNIT-I

Two-byte instruction:1st byte specifies the operation code and the second byte specifies theoperand.Opcode & Operand Machine CodeMVI A, 32H 3E (0011 1110) 32 (0011 0010)Move immediate 32H to the Accumulator AThree-byte instruction:1st byte specifies the opcode and the following two bytes specify the 16-bitaddress.Opcode & Operand Machine CodeJMP 2085C3 (1000 0000) 85 (1000 0101) 20 (0010 0000)The PC jumps to the memory location 2085H.Opcode format::In the design of the 8085 microprocessor, all operation, registers and statusflags are identified with a specific code. The specific codes for operationsand registers are given below for reference:Function Operation CodeAdd the contents of a register to the accumulator10000 RRR (3bit reservedfor register)Move the contents 01 (2 bit opcode)

Registers CodeB 000C 001D 010E 011H 100L 101A 111

Page 19: MPMC-UNIT-I

The opcode is made of operation code and register codes:ADD B - 10000 000 = 80 (opcode)ADD C - 10000 001 = 81 (opcode)MOV C, A - 01 DDD SSS;01 001 111 = 4F (opcode)

ADDRESSING MODESAddressing Modes DefinitionThe various ways of specifying data are called addressing modes.Data FormatThe 8085 is an 8-bit microprocessor, and it processes only binary numbers.The commonly used codes and data formats are as follows:

ASCII code – This is a 7-bit alphanumeric code that represents decimalnumbers, English alphabets, and non printable characters.Extended ASCII is an 8-bit ASCII code.

BCD code – This term stands for binary coded decimal, used for decimalnumbers. The decimal numbering system has only ten digits – 0 to 9. Theseare represented in BCD by 0000 to 1001. The remaining numbers A (1010)and F(1111) are considered invalid.

Signed integer – This is either a positive or negative number. The mostsignificant D7 is used for the sign. 0 represents a positive number and 1, anegative number. All the negative numbers are a microprocessor isrepresented in 2’s complement.

Unsigned integer – An integer without a sign can be represented by allbits in a microprocessor. Therefore, the largest number that can

Page 20: MPMC-UNIT-I

be processed at one time is FFH. Numbers larger than 8-bits are processedby dividing them in groups of 8 bits.8085 Addressing Modes :The 8085 has five addressing modes:a) Direct/Absolute:Instructions using this mode specify the effective address as part of theinstruction.These instructions contain 3 bytes, with the first byte as the OP codefollowed by 2 bytes of address of data (lower-order byte of the address inbyte 2, the higher-order byte of the address in byte 3)

b) Register:This mode specifies the register or register pair that contains data.

c) Register Indirect:This mode contains a register pair which stores the address of data (the high-order of the address in the first register of the pair andthe low order byte in the second)

Page 21: MPMC-UNIT-I

d) Implied or inherent:

e) The instructions using this mode have no operands. Immediate:This instruction uses Immediate Addressing because the Accumulator willbe loaded with the value that immediately follows. Immediate addressing isvery fast since the value to be loaded is included in the instruction. However,since the value to be loaded is fixed at compile-time it is not very flexible.

INSTRUCTION SET8085 Instruction Set: The 8085 instruction set contains 74 basicinstructions and they support five addressing modes (direct, register, registerindirect, implied and immediate).Types of instructions:_ Data transfer (move or copy)_ Arithmetic (addition, subtraction and increment/decrement)_ Logical (And, Or, exclusive-or, rotate, compare and complement)_ Branch (jump, call, return, restart)_ Machine Control (halt, interrupt etc).Instructions for data transfer:One of the primary functions of a microprocessor is copying data, from aregister (or I/O or memory) called the source to another register (or

Page 22: MPMC-UNIT-I

I/O or memory) called the destination. These instructions do not affect theflags. The following instructions are primarily available for operations:MOV Rd, Rs - Move; Copy a data byte.MVI R, 8-bit data- Move immediate; Load a data byte directly.OUT 8-bit port address- Output to port; Send a data byte to an output device.IN 8-bit port address- Input from port; Read a data byte from an input evice.(R-register; Rd- Register Destination; Rs-Register Source)

Arithmetic Instructions:The 8085 microprocessor performs various arithmetic operations, such asadditions, subtraction, increment and decrement. The ADD and SUB(addition/subtraction) instructions are performed in relation to the contentsof the accumulator. However, the INR or DCR

Page 23: MPMC-UNIT-I

increment/decrement) operations can be performed in any register. Thearithmetic instructions have the following mnemonics:ADD R -Add the contents of any register R to the accumulator A.ADI 8-bit data -Add immediate; [A] _ [A] + dataSUB R -Subtract the contents of any register R from the accumulator Acontents.SUI 8-bit data -Subtract Immediate; [A] _ [A] - dataINR R -Increment the register by 1DCR R -Decrement the register by 11) The arithmetic operations implicitly assume that the contents of theaccumulator are one of the operands.2) The results of the operations are stored in the accumulator.3) The flags are modified to reflect the data conditions of an operation.4) In the Add instruction, if the sum is larger than 8-bit, Cy is set.5) The subtract operation is performed by using the 2's complement method.6) If the subtraction results in a negative number, the answer is in 2'scomplement and Cy (borrow flag) is set.7) In unsigned arithmetic operations, the sign flag should be ignored.

Page 24: MPMC-UNIT-I

8) INR and DCR do not affect Cy flag.

Logic Operations:A microprocessor is basically a programmable logic chip and the 8085instruction set includes such logic functions as AND, OR, ExclusiveOR(XRA) and NOT (Complement). All logic operations are performed inrelation to the contents of the accumulator. The logic instructions havethe following mnemonics:ANA R -Logical AND with the accumulator A.ANI 8-bit data -AND immediate with AccumulatorORA R -Logically OR with Accumulator.ORI 8-bit data -OR immediate with AccumulatorXRA R -Logical Exclusive-OR with Accumulator.XRI 8-bit data -Exclusive-OR immediate with AccumulatorCMA -Complement Accumulator

1) Implicitly assume that the accumulator is one of the operands.2) Clears the Cy flag; Modify Z, P and S flags according to the dataconditions of the result.3) CMA is an exception. It does not affect any flag.4) The result is left in the accumulator.5) Do not affect the contents of the operand register.6) Cannot be performed directly with the contents of two registers.8085's Other Arithmetic Instructions:In-addition to the arithmetic instructions discussed, 8085 has instructionslike DAA, DAD etc

Page 25: MPMC-UNIT-I

DAA - Decimal Adjust Accumulator; Converts the 8-bit number stored inthe accumulator into BCD; Inherent addressing mode;DAD rp - 16 Bit Addition; [HL] _ [HL] + [rp]; Register addressing mode;DAD B - [HL] _ [HL] + [BC]8085's Rotate Instructions:Rotate left does multiplication and rotate right does division (Try shift leftand shift right on 0011 0011). The following instructions are available:RAL - Rotate left accumulator by one position through the carry flag; i.e. 7thbit goes to Cy; Cy goes to 0th bit;RAR - Rotate right by one position through the carry flag; i.e. 0th bit goes toCy; Cy goes to 7th bit;RLC - Rotate left without carry; 7th bit goes to 0th position and to the Cy;RRC - Rotate right without carry; 0th bit goes to 7th position and to the Cy.8085's Stack Instructions:The Stack in an 8085 microcomputer system is described as a set of memoryinstructions in the R/W memory, specified by the programmer in the mainprogram. These locations are used to store data temporarily during theexecution of the program. The beginning of the stack is definedby using the instruction LXI SP.Peripheral I/O InstructionsThe 8085 has two instructions for data transfer between the processor andI/O device. The instruction IN inputs data from an input device such askeyboard into the accumulator. The instruction OUT sends the contents ofthe accumulator to the output device such as an LED display.8085 I/O Instructions:IN and OUT are the two instructions available for data transfer between theprocessor and the I/O device. These are two byte instructions, with thesecond byte specifying the address or the port number of an I/O device.I/O Execution: 8085 executes OUT instruction in three machine cycles (10T-states/clock periods). Suppose the following instruction is to be executedat 2050H:OUT 01H; d3 is the machine code for OUT; the memory contents shall be asfollows.2050 d32051 01In the first machine cycle (M1, Opcode fetch), the 8085 places the high-order memory address 20H on A15-A8 and the low-order address50H on AD7-0. ALE goes HIGH and IO/M goes LOW indicating memory-related operation and the availability of address on AD7-0. In T2, the

Page 26: MPMC-UNIT-I

Microprocessor sends the RD control signal, when combined with IO/Mgenerate MEMR; the processor fetches the instruction code d3 using the databus. On decoding, 8085 finds out that it is a 2-byte instruction and thesecond byte to be read from memory.In the second machine cycle, M2 (Memory Read), 8085 places the nextaddress 2051H on the address bus and gets the device address 01H via thedata bus.

In the third machine cycle, M3 (I/O Write), 8085 places the device address01H on the low-order (AD7-0) as well as on the high order (A15-8) address bus. The IO/M signal goes high to indicate that it is an I/OOperation. At T2, the accumulator contents are placed on the data bus(AD7-0) followed byWR. From IO/M and WR, IOW signal can begenerated to enable an output device.The IN instruction reads data from input devices such as switches,keyboards and A/D data converters. This is a two-byte instruction andreads input and places it in the accumulator. This is executed in threemachine cycles. The M1 and M2 cycles are identical as in OUTinstruction. In M3, control signal RD is generated instead of WR; data flowsfrom an input port to the accumulator.Device (I/O) selection:In absolute decoding all address lines are decoded to generate one uniqueaddress. In some cases only one address line is used to selectthe output device (like A0); This is known as linear-select decoding. As aresult, the device will have multiple addresses like (for A0=0) 00, 02,04,…FE;. Such multiple addresses will not create serious problems in smallsystems provided they are not assigned to other devices.

Page 27: MPMC-UNIT-I

8085 BASED MICROCOMPUTER SYSTEM4 The general 8085 based micro computer system is illustrated below:

It includes interfacing devices like buffers, decoders, latches, EPROM,RAM, Input devices (keyboard), output devices (LED display, printer) etc.4 The latch (octal) de-multiplexes the bus using the signal ALE and the logicgates generate the necessary control signals.4 To increase the driving capacity of the buses, a unidirectional bus driver isused for the address bus and a bi-directional bus driver is used for the databus.The control program is stored in the EPROM. Depending on the capacity ofthe EPROM, number of address lines is used. The un-used lines are used forchip selection. On power, the instruction code stored at 0000H is fetched andexecuted and the execution continues as per the program in the EPROM.The primary functions of the program are:a) Reading the hex keyboard and checking for a key-closure; Continue thecheck until the key closure.b) Displaying the hex equivalent at the output port, such as seven segmentsLED.c) Storing the key-equivalent in the memory (RAM); decoding the keysequence and continuing with the software operation (temperature control,stepper motor control, display control etc)The MEMR, MEMW, IOR, IOW are the control signals which are used forread/write operations at Memory or IO devices.

Page 28: MPMC-UNIT-I

JAYAM COLLEGE OF ENGINEERING AND TECHNOLOGY (An ISO 9001:2000 Certified institution)

DHARMAPURIJCET/ERP/CSE/CF/SYL

DEPARTMENT: COMPUTER SCIENCE AND ENGGSEMESTER :V ACADEMIC YEAR: 2005 – 2006COURSE NAME: MICROPROCESSORS COURSE CODE: CS-334

Questions

Part-A

1. Define Microprocessor2. Define System bus3. Define Accumulator4. Define Direct Addressing Mode5. Define Data Transfer instruction6. Define Conditional Jumps7. Define Microcomputer system8. What are the types of Addressing?9. Define Memory and types of Memory10.Difference between Arithmetic and Logic functions

Part-B

1. Explain the Pin and signal of 8085 Microprocessor2. Explain the 8085 Architecture3. Explain the Addressing Modes4. Explain the Programming with 8085 Microprocessor5. Explain the 8085 based microcomputer system