Documente Academic
Documente Profesional
Documente Cultură
MICROPROCESSOR
Microprocessor is a programmable, multipurpose, clock driven integrated electronic
component and decision-making capability similar to that of the Central Processing Unit
(CPU) of a computer
Address Bus; The most significant 8 bits of the memory address or the 8 bits of the I/0
addresses, High Impedance state during Hold mode.
AD0-AD7 (Input/Output 3state)
Multiplexed Address/Data Bus; Lower 8 bits of the memory address (or I/0 address) appear on
the bus during the first clock cycle of a machine state. It then becomes the data bus during the
second and third clock cycles. High Impedance state during Hold mode
ALE (Output)
Address Latch Enable: It occurs during the first clock cycle of a machine state and enables the
address to get latched into the on chip latch of peripherals. The falling edge of ALE is set to
guarantee setup and hold times for the address information. ALE can also be used to strobe the
status information. ALE is never 3stated.
SO, S1 (Output)
S1 So STATUS
0 0 HALT
0 1 WRITE
1 0 READ
1 1 FETCH
RD (Output 3state)
READ; indicates the selected memory or 1/0 device is to be read and that the Data Bus is
available for the data transfer. 3 stated during Hold and Halt.
WR (Output 3state)
WRITE; indicates the data on the Data Bus is to be written into the selected memory or 1/0
location. Data is set up at the trailing edge of WR. High Impedance state during Hold mode.
READY (Input)
If Ready is high during a read or write cycle, it indicates that the memory or peripheral is ready
to send or receive data. If Ready is low, the CPU will wait for Ready to go high before
completing the read or write cycle.
HOLD (Input)
HOLD; indicates that another Master is requesting the use of the Address and Data Buses. The
CPU,upon receiving the Hold request. will relinquish the use of buses as soon as the completion
of the current machine cycle. Internal processing can continue. The processor can regain the
buses only after the Hold is removed. When the Hold is acknowledged, the Address, Data, RD,
WR, and IO/M lines are 3stated.
HLDA (Output)
HOLD ACKNOWLEDGE; indicates that the CPU has received the Hold request and that it
will relinquish the buses in the next clock cycle. HLDA goes low after the Hold request is
removed. The CPU takes the buses one half clock cycle after HLDA goes low.
INTR (Input)
INTERRUPT REQUEST; is used as a general purpose interrupt. It is sampled only during the
next to the last clock cycle of the instruction. If it is active, the Program Counter (PC) will be
inhibited from incrementing and an INTA will be issued. During this cycle a RESTART or
CALL instruction can be inserted to jump to the interrupt service routine. The INTR is enabled
and disabled by software. It is disabled by Reset and immediately after an interrupt is accepted.
INTA(Output)
INTERRUPT ACKNOWLEDGE; is used instead of (and has the same timing as) RD during
the Instruction cycle after an INTR is accepted. It can be used to activate the 8259 Interrupt
chip or some other interrupt port.
RST5.5
RST6.5-(Inputs)
RST7.5
RESTART INTERRUPTS; These three inputs have the same timing as I NTR except they
cause an internal RESTART to be automatically inserted.
The priority of these interrupts is ordered as shown above. These interrupts have a higher
priority than the INTR.
TRAP(Input)
Trap interrupt is a nonmaskable restart interrupt. It is recognized at the same time as INTR. It
is unaffected by any mask or Interrupt Enable. It has the highest priority of any interrupt.
RESETIN(Input)
Reset sets the Program Counter to zero and resets the Interrupt Enable and HLDA flipflops.
None of the other flags or registers (except the instruction register) are affected The CPU is
held in the reset condition as long as Reset is applied.
RESETOUT(Output)
Indicates CPlJ is being reset. Can be used as a system RESET. The signal is synchronized to
the processor clock.
X1,X2(Input)
Crystal or R/C network connections to set the internal clock generator X1 can also be an
external clock input instead of a crystal. The input frequency is divided by 2 to give the internal
operating frequency.
CLK(Output)
Clock Output for use as a system clock when a crystal or R/ C network is used as an input to
the CPU. The period of CLK is twice the X1, X2 input period.
IO/M(Output)
IO/M indicates whether the Read/Write is to memory or l/O Tristated during Hold and Halt
modes.
SID (Input)
Serial input data line The data on this line is loaded into accumulator bit 7 whenever a RIM
instruction is executed.
SOD (output)
Serial output data line. The output SOD is set or reset as specified by the SIM instruction.
Vcc
+5 volt supply.
Vss
Ground Reference.
Register Structure
The fig. shows the register structure of 8085. The shaded portion of this register model is called
programmer’s model of 8085. It includes six 8-bit registers-(b,C,D,EH and L) one accumulator,
one flag register and two 16-bit registers (SP and PC). All these registers are accessible to
programmer and hence they are included in the programmer’s model. The remaining registers
– temporary, W and Z are not accessible to the programmers; they are used by microprocessor
for internal, intermediate operations.
Temporary
register
W Reg Z Reg
A Reg Flag Reg
B Reg C Reg
D Reg E Reg
H Reg L Reg
Slack pointer (SP)
Program counter (PC)
2. Temporary Registers
a) Temporary data register b) W and Z registers
B,C,D,E,H, and L are 8-bit general purpose registers can be used as a separate 8-bit
registers or as 16-bit register pairs, BC, DE, and HL. When used in register pair mode, the high
order byte resides in the first register (i.e. in B when BC is used as a register pair) and the low
order byte in the second (i.e. In C when BC is used as a register pair).
HL pair also functions as a data pointer or memory pointer. These are also called scratchpad
registers, as user can store data in them. To store and read data from these registers bus access
is not required, it is an internal operation. Thus it provides an efficient way to store intermediate
results than the memory locations which require bus access and hence more time to perform
the operation.
2. Temporary Registers
Temporary Data Register: The ALU has two inputs. One input is supplied by the accumulator
and other from temporary data register. The programmer cannot access this temporary data
register. However, it is internally used for execution of most of the arithmetic and logical
instructions.
For example: ADD B is the instruction in the arithmetic group of instructions which adds the
contents of register A and register B and stores result in register A. The addition operation is
performed by ALU. The ALU takes inputs from register A and temporary data register. The
contents of register B are transferred to temporary data register for applying second input to
the ALU.
W and Z Registers: W and Z registers are temporary registers. These registers are used to hold
8-bit data during execution of some instructions. These registers are not available for
programmer, since 8085 uses them internally.
The CALL instruction is used to transfer program control to a sub program or subroutine. This
instruction pushes the current PC contents onto the stack and loads the given address into the
PC. The given address is temporarily stored in the W and Z registers and placed on the bus for
the fetch cycle. Thus the program control is transferred to the address given in the instruction.
XCHG instruction exchanges the contents of H with D and L with E. At the time of exchange
W and Z registers are used for temporary storage of data.
S-Sign flag: After the execution of arithmetic or logical operations, if bit D7 of the result is 1,
the sign flag is set. In a given byte if D7 is 1, the number will be viewed as negative number.
If D7 is 0, the number will be considered as positive number.
Z- Zero flag: The zero flag sets if the result of operations in ALU is zero and flag resets if result
is non zero. The zero flag is also set if a certain register content becomes zero following an
increment or decrement operation of that register.
AC-Auxiliary Carry flag: This flag is set if there is an over flow out of bit 3 i.e., carry from
lower nibble to higher nibble (D3 bit to D4 bit). This flag is used for BCD operations and it is
not available for the programmer.
P- Parity flag: Parity is defined by the number of ones present in the accumulator. After an
arithmetic or logical operation if the result has an even number of ones, i.e. even parity, the
flag is set. If the parity is odd, flag is reset.
CY- Carry flag: This flag is set if there is an over flow out of bit 7. The carry flag also serves
as a barrow flag for subtraction. In both the examples shown below, the carry flag is set.
ADDITION SUBTRACTION
C) Instruction Register: In a typical processor operation, the processor first fetches the opcode
of instruction from memory (i.e. it places an address on the address bus and memory responds
by placing the data stored at the specified address on the data bus). The CPU stores this opcode
in a register called the instruction register. This opcode is further sent to the instruction decoder
to select one of the 256 alternatives.
In case of JUMP and CALL instructions, address followed by JUMP and CALL instructions is
placed in the program counter. The processor then fetches the next instruction form the new
address specified by JUMP or CALL instruction. In conditional JUMP and conditional CALL
instructions, if the condition is not satisfied, the processor increments program counter by three
so that it points the instruction followed by conditional JUMP or CALL instruction; otherwise
processor fetches the next instruction from the new address specified by JUMP or CALL
instruction.
b) Stack Pointer (SP): The stack is a reserved area of the memory in the RAM where the most
recent stack entry.
The 8085’s ALU perform arithmetic and logical functions on eight bit variables. The arithmetic
unit performs bitwise fundamental arithmetic operations such as addition and subtraction. The
logic unit performs logical operations such as complement, AND, OR and EX-OR, as well as
rotate and clear. The ALU also looks after the branching decisions.
Instruction Decoder
As mentioned earlier, the processor first fetches the opcode of instruction from memory and
stores this opcode in the instruction register. It is then sent to the instruction decoder. The
instruction decoder decodes it and accordingly gives the timing and control signals which
control the register, the data buffers, ALU and external peripheral signals (explained in later
sections) depending on the nature of the instruction.
The 8085 executes seven different types of machine cycles. It gives the information about
which machine cycle is currently executing in the encoded form on the S0, S1 and IO/ M lines.
This task is done by machine cycle encoder.
Address Buffer
This is an 8-bit unidirectional buffer. It is used to drive external high order address bus (A15-
Ag). It is also used to tri – state the high order address bus under certain conditions such as
reset, hold, halt, and when address lines are not in use.
This is an 8-bit directional buffer. It is used to drive multiplexed address / data bus, i.e. low
order address bus (A7-A0) and data bus (D7-D0). It is also used to tri-state the multiplexed
address/ data bus under certain conditions such as reset, hold, halt and when the bus is not in
use.
The address and data buffers are used to drive external address and data buses respectively.
Due to these buffers the address and data buses can be tri- stated when they are not in use.
This 16-bit register is used to increment or decrement the contents of program counter or stack
pointer as a part of execution of instructions related to them.
Interrupt Control
The processor fetches, decodes and executes instructions in a sequence. Some times it is
necessary to have processor the automatically execute one of a collection of special routines
whenever special condition exits within a program or the microcomputer system. The most
important thing is that, after execution of the special routine, the program control must be
transferred to the program which processor was executing before the occurrence of the special
condition. The occurrence of this special condition is referred as interrupt. The interrupt control
block has five interrupt inputs RST 5.5,,RST6.5, RST7.5, TRAP and INTR and one
acknowledge signal INTA .
In situations like, data transmission over long distance and communication with cassette tapes
or a CRT terminal, it is necessary to transmit data bit by bit to reduce the cost of cabling. In
serial communication one bit is transferred at a time over a single line. The 8085’s serial I/O
control provides two lines, SOD and SID for serial communication. The serial output data
(SOD) line is used to send data serially and serial input data (SID) line is used to receive data
serially.
1. Address Bus
2. Data Bus.
3. Control & status signals
4. Power supply & frequency signals
5. Externally initiated signals
6. Serial I/O ports
Figure shows a schematic that uses a latch and the ALE signal to demultiplex the bus.
The bus AD7- AD0 is connected as the input to the latch 74LS373. The ALE signal is connected
to the Enable (G) pin of the latch, and the Output control OC signal of the latch is grounded.
Figure shows that the ALE goes high during T1. When the ALE is high, the lathc is
transparent; this mean that the output changes according to input data. During T1, the output
of the latch is 05H. When the ALE goes low , the data byte 05H is latched until the next ALE,
and the output of the latch represents the low – order address bus A7 – A0 after the latching
operation.
Figure: Shows the RD (Read) as a control signal. Because this signal is used both for
reading memory and for reading an input device, it is necessary to generate two different Read
signals; one for meniory and another for input. Similarly, two separate Write signals must be
generated.
Figure shows that four different control signals are generated by combining the signals
RD, WR , and IO / M . The signal IO/ M goes low for the memory operation. This signal is
ANDed with RD and WR signals by using the 74LS32 quadruple two input OR gates, as
shown in figure. The OR gates are functionally connected as negative NAND gates. When
both input signals go low, the output of the gates go low and generate MEMR (Memory Read)
and MEMW (Memory Write) control signals. When the IO/M signal goes high, it indicates
the periopheral I/O operation. Figure. Shows that this signal is complemented using the Hex
inverter 74LS04 and ANDed with the RD AND WR signals to generate IOR (I/O Read) and
IOW (I/O Write) control signals.
Figure: Schematic to Generate Read/Write Control signals for Memory and I/O
To demultiplex the bus and to generate the necessary control signals, the 8085
microprocessor requires a latch and logic gates to build the MPU, as shown in figure. This
MPU can be interfaced with any memory or I/O. The necessary control signals. Figure shows
the demultiplexed address bus, the data bus, and the four active low control signals.
MEMR, MEMW, IOR, and IOW . In addition, to increase the driving capacity of the buses,
a unidirectional bus driver is used for the address bus and a bidirectional bus driver is used for
the data bus. Now we can examine various operations the 8085 microprocessor performs in
terms of machine cycles and T – states.
MEMORY INTERFACING CONCEPTS
Microprocessor 8085 can access 64K bytes memory since address bus is 16-bit. But it is not
always necessary to use full 64K bytes address space. The total memory size depends upon the
application.
Absolute decoding
In absolute decoding technique, all the higher address lines are decoded to select the
memory chip, and the memory chip is selected only for the specified logic levels on these high-
order address lines; no other logic levels can select the chip. Figure shows the memory interface
with absolute decoding. This addressing technique is normally used in large memory systems.
Linear decoding
In small systems, hardware for the decoding logic can be eliminated by using individual
high-order address lines to select memory chips. This is referred to as linear decoding.
Figure: Typical Memory Chips R/W Static Memory (a) and EPROM (b)
The primary function of memory interfacing is that the microprocessor should be able
to read from the write into a given register of a memory chip. Recall from chapter that to
perform these operations, the microprocessor should.
Let us examine the timing diagram of the Memory Read Operation (Figure) to understand how
the 8085 can read from memory. Figure is the M2 cycle of figure except that the address bus
is de multiplexed. We could also use the M1 cycle to illustrate these interfacing concepts.
The process of address decoding should result in identifying a register for a given
address. We should be able to generate a unique pulse for a given address. For example, in
figure 12 address lines (A11 –A0) are connected to the memory chip, and the remaining four
address line (A15 –A12) of the 8085 microprocessor must be decoded. Figure shows two
methods of decoding these lines: one by using a NAND gate and the other by using is 3-to-8
decoder. The output of the NAND goes active and selects the chip only when all address line
A15 –A12 are at logic 1. We can obtain the same result by using O7 of the 3-to-8 decoder.
Which is capable of decoding eight different input addresses. If the decoder circuit, three input
lines can have eight different logic combinations from 000 to III: each input combination can
be identified by the corresponding output line if Enable lines are active. In this circuit, the
Enable lines E1 and E 2 are enabled by grounding, and A15 must be at logic 1 to enable E3.
We will use this address decoding schemes to interface n 4K EPROM and a 2K R/W memory
as illustrated to the next two examples.
Figure: Address Decoding Using NAND Gate (a) and 3- to- 8 Decoder (b)
Interfacing Circuit:
Figure shows an interfacing circuit using a 3-to-8 decoder to interface the 2732 EPROM
memory chip. It is assumed here that the chip has already been programmed, and we will
analyse the interfacing circuit in terms of the same three steps outlined previously:
Step 1: The 8085 address lines A11-A0 are connected to pins A11-A0 of the memory chip to
address 4096 registers.
Step 2: The decoder is used to decode four address lines A15 –A12. The output O0 of the
Step 3: For this EPROM, we need one control signal: Memory Read
MEMR , active low.
The
MEMR is connected to OE to enable the output buffer, OE is the same as RD in
figure
We can obtain the address range of this memory chip by analyzing the possible logic
levels on the 16 address lines. The logic levels on the address lines A15 –A12 must be 0000
to assert the chip Enable, and the address lines A11-A0 can assume any combinations from all
0s to all 1s. Therefore, the memory address of this chip ranges from 0000H to OFFFH, as
shown below.
We can verify the memory address range in terms of our analogy of page and line
numbers, as discussed in chapter. The chip’s 4096 bytes memory can be viewed as 16 pages
with 256 lines each. The high-order Hex digits range from 00 to OF, indicating 16 pages -
0000H to 00FFH and 0100H to 01FFH.
2n =16000
log2n =log16000
n=log16000/log2
n=13.96(must be an integer)
n=14
In this section, we will analyze the circuit used for interfacing eight DIP switches, as
shown in figure. The circuit includes the 74LS138 3 – to – 8 decoder to decode the low order
bus and the tri – state octal buffer (74LS244) to interface the switches to the data bus. The port
can be accessed with the address 84H: however, it has multiple addresses, as explained below.
Hardware:
Figure shows the 74LS244 tri – state octal buffer used as an interfacing device. The
device has two groups of four buffer each, and they are controlled by the active low signals
OE . When OE is low, the input data show up on the output lines (connected to the data bus),
and when OE is high, the output lines assume the high impedance state.
Interfacing Circuit
Figure shows that the low – order address bus, except the lines A4 and A3 is connected
to the decoder (the 74LS138); the address lines A4 and A3 are left in the don’t care state. The
output line O4 of the decoder goes low when the address bus has the following address (assume
the don’t care lines are at logic 0);
Figure:
Figure: Seven-Segment LED: LED Segments (a) Common- Anode LED (b) Common Cathode
LED (c)
The seven segments, A through G, are usually connected to data lines D0 through Dg
respectively. If the decimal – point segment is being used, data line D7 is connected to DP:
otherwise it is left open. The binary code required to display a digit is determined by the type
of the seven – segment LED (common cathode or common anode), the connections of the data
lines, and the logic required to light the segment. For example, to display digit 7 at the LED
in figure the requirements are as follows:
It is a common – anode seven – segment LED, and logic 0 is required to turn on a segment,
To display digit 7, segments A, B, and C should be turned on.
The binary code should be
Data Lines D7 D6 D5 D4 D3 D2 D1 D0
Bits X 1 1 1 1 0 0 0 =78H
Segments NC G F E D C B A
The code for each digit can be determined examining the connections of the data lines
to the segments and the logic requirements.
Figure: Interfacing Seven Segment LED
To design an output port with the address F5H the address lines A7 – A0 should have
the following logic:
A7 A6 A5 A4 A3 A2 A1 A0
1 1 1 1 0 1 0 1 = F5H
This can be accomplished by using A2, A1 and A0 as input lines to the decoder. A3
can be connected to active low enable E1, and the remaining address lines can be connected to
E 2 through the 4 – input NAND gate. Figure shows an output port with the address F5H. The
output O5 of the decoder is logically ANDed with the control signal IOW using the NOR gate
(74LS02). The output of the NOR gate is the I/O selecte pulse that is used to enable the latch
(74LS373). The control signal IOW is generated by logically ANDing IO/ M and WR
signals in the negative HAND gate (physically OR gate 74LS32).
Instructions the following instructions are necessary to display digit 7 at the output port
The first instruction loads 78 H in the accumulator; 78 H is the binary code necessary to display
digit 7 at the common – anode seven – segment LED. The second instruction sends the contents
of the accumulator (7811) to the output port F5H. When the 8085 executes the OUT
instruction, the digit 7 is displayed at the port as follows:
In the third machine cycle M3 of the OUT instruction (refer to figure) the port address F5H is
placed on the address bus A7 – A0 (it is also duplicated on the high – order bus A15 – Ag, but
we have used the low – order bus for interfacing in the example)
The address F5H is decoded by the decoding logic (decoder and 4 input NAND gate), and the
output O5 of the decoder is assented.
During T2 of the M3 cycle the 808 places the data byte 78H from the accumulator on the data
bus and asserts the WR signal
In figure when the IOW signal is asserted, the output of the NOR gate 74LS02 goes high and
enables the latch 74LS373. The data byte (78H), which is already on the data bus at the input
of the latch, is passed on to the output of the latch and displayed by the seven segment LED.
However, the byte is latched when the WR signal is deasserted during Tg.
Figure shows a schematic of interfacing I/O devices using the memory – mapped I/O
technique. The circuit includes one input port with eight DIP switches and one output port to
control various processes and gates, which are turned on / off by the microprocessor according
to the corresponding switch positions. For example, switch S7 controls the cooling system,
and switch S0 controls the exit gate. All switch inputs are tied high, therefore, when a switch
is open (off). It has +5 V, and when a switch is closed (on), it has logic 0. the circuit includes
one 3 – to -8 decoder, one 8 – input NAND gate, and one 4 – input NAND gate to decode the
address bus. The output O0 of the decoder is combined with control signal MEMW to
generate the device select pulse that enables the octal latch. The output O1 is combined with
the control signal MEMR to enable the input port. The eight switches are interfaced using tri
– late buffer 74LS244, and the solid state relays controlling various processes are interfaced
using an octal latch (74LS373) with tri-state out put.
The various process control devices are connected to the data bus through the latch
74LS373 and solid state relays. If an output bit of the 74LS373 is high, it activates the
corresponding relay and turns on the process; the process remains on until the bit stays high.
Therefore, to control these safety processes we need to supply an appropriate bit pottem to the
latch.
The 74LS373 is a latch followed by a tri – state buffer as shown in figure. The latch
and the buffer are controlled independently by the Latch Enable (LE) and Output enable
OE
. When LE is high, the data enter the latch, and when LE goes low, data are btched. The
latched data are available on the output lines of the 74LS373 if the buffer is enabled by OE
(active low). If OE is high, the output lines go into the high impedance state .
Figure shows that the OE is connected to the ground; thus the latched data will keep
the relays on/off according to the bit pattern. The LE is connected to the deviceselect pulse,
which is asserted when the output O0 of the decoder and the control signal MEMW go low.
Therefore, to assert the I/O select pulse, the output port address should be FFF8H, as shown
below:
The DIP switches are interfaced with the 8085 using the tri-state buffer 74LS244. The
switches are tied high, and they are turned on by grounding, as shown in figure. The switch
positions can be read by enabling the signal OE , which is asserted when the output O1 of the
decoder and the control signal MEMR go low. Therefore, to read the input port, the port
address should be
Instructions. To control the processes according to switch positions, the microprocessor should
read the bit pattern at the input port and send that bit patterns to the output port. The following
instructions can accomplish this task:
When this program is executed, the first instructin reads the bit patter 1011 0111 (B7H)
at the input FFF9H and places that reading in the accumulator; this bit pattern represents the
on-position of switches S6 and Sy. The second instruction complements the reading: this
instruction is necessary because the 0-position has logic 0, and to turn on solid state relays logic
1 is necessary. The third instruction sends the complemented accumulator contents (0100 1000
= 43H) to the output port FFF8H. The 74LS373 latches the data byte 0100 1000 and turns on
the heating system and lights. The last instruction JMP READ, takes the program back to the
beginning and repeats the loop continuously. Thus, it switches continuously.
Data transfer is between any register and Data transfer is between Accumulator
3
I/O device. and I/O device.
Maximum number of I/O devices are Maximum number of I/O devices are
4
65536. 256.
Decoding 16 bit address may require more Decoding 16 bit address may require
5
hardware. less hardware.
The 8085 micro processor is designed to execute 74 different instruction types. Each
instruction has two parts: operation code, known as opcode, and operand. The opcode is a
command such as Add, and the operand is an object to be operated on, such as a byte or the
contents of a register. Some instructions are 1 –byte instructions and some are multi-byte
instructions. To execute an instruction, the 8085 needs to perform various operations such as
Memory Read / Write and I/O Read / Write. However, there is no direct relationship between
the number of bytes of an instruction and the number of operations the 8085 has to perform
(this will be clarified later). In preceding section, numerous 8085 signals and their functions
were described. Now we need to examine these signals in conjuction with execution of
individual instructions and their operations. This task may appear over whelming at the
beginning; fortunately, all instructions are divided into a few basic machine cycles and these
machine cycles and these machine cycles are divided to precise system clock periods.
Basically the micro processor external communication functions can be divided into
three categories.
These functions are further divided into various operations (machine cycles), as shown
in table. Each instruction consists of one more of these machine cycles, and each machine
cycle is divided into T – states.
In this section, we will focus on the first three operations listed in table. Opcode Fetch.
Memory Read, and Memory Write – and examine the signals on various buses in relation to
the system clock. In the next section, we will use these timing diagrams to interface memory
with the 8085 microprocessor. Similarly, we will discuss timings of other machine cycles in
later chapters in the context of their applications. For example, I/O Read / Write machine
cycles will be discussed in chapter I/O interfacing and Interrupt Acknowledge will be discussed
in chapter “Interrupts”.
The first operation in any instruction is Opcode Fetch. The micro processor needs to
get (fetch) this machine code from the memory register where it is stored before the micro
processor can begin to execute the instruction.
We discussed this operation in example figures shows how the 8085 fetches the
machine code, using the address and the data buses and the control signal. Figure shows that
at T1 the high – order memory address 20H is placed on the address lines A15 – Ag, the low –
order memory address 05H is placed on the bus AD7 – AD0 and the ALE . Signal goes high
similarly, the status signal IO/ M goes low, indicating that this is a me memory – related
operation. (for the sake of clarity, the other two satus signals, S1 and S0 are not shown in
figure they will be discussed in the next section.)
Step 2: The control unit sends the control signal RD to enable the memory chip. This is similar
to ringing the doorbell in our analogy of a package pickup.
The control signal RD is sent out during the clock period T2, thus enabling the memory
chip. The RD signal is active during tow clock periods.
Figure: Timing: Transfer of Byte from Memory to MPU
Step 3: The byte from the memory location is placed on the data bus.
When the memory is enabled, the instruction byte (4FH) is placed on the bus AD7 –
AD0 and transferred to the microprocessor. The RD signal causes 4FH to be placed on bus
AD7 – AD0 (shown by the arrow) and when RD goes high, it causes the bus to go into high
impedance.
Step 4: The byte is placed in the instruction decoder of the microprocessor, and the task is
carried out according to the instruction.
The machine code or the byte (4FH) is decoded by the instruction decoder, and the
contents of the accumulator and copied into register C. This task is performed during the period
T4 in figure.
The above four steps are similar to the steps to the steps listed in our analogy of the
package shows the timing of the Opcode Fetch machine cycle in relation to the system’s clock.
In this operation, the processor reads a machine code (4FH) from memory. However to
differentiate an opcode from a data byte or an address, this machine cycle is identified as the
Opcode Fetch cycle by the status signals (IO/ M = 0,S1 = 1,S0 = 1); The active low IO/ M
signal indicates that it is a memory operation, and S1 and S0 being high indicate that it is an
opcode Fetch cycle.
This opcode Fetch cycle is called the M1 cycle and has four T – states. The 8085 uses
the first three states T1 – T3 to fetch the code and T4 to decode and execute the opcode. In the
8085 instruction set, some instructions have opcodes with six T – states. When we study the
example of the Memory Read machine cycle, discussed in the next section, we may find that
these two operations (Opcode Fetch and Memory / Read) are almost identical except that the
Memory Read Cycle has three T – states.
The 8085 places a 16 – bit address on the address bus and with this address only one register
should be selected. For the memory chip in figure only 11 address lines are required to identify
2048 registers. Therefore, we can connect the low – order address lines A10 – A0 of the 8085
address but to the memory chip. The internal decoder of the memory chip will identify and
select the register for the EPROM. Figure
The remaining 8085 address lines (A15 – A11) should be decoded to generate a Chip Select
CS signal unique to that combination of address logic .
The 8085 provides two signals – IO/ M and RD - to indicate that it is a memory read operation.
The IO/ M and RD can be combined to generate the MEMR (Memory Read) control signal
that cab be used to enable the output buffer by connecting to the memory signal RD .
Figure also shows that memory places the data byte from the addressed register during T2 and
that is read by the microprocessor before the end of T3
To write into a register, the microprocessor performs similar steps as it reads from a
register, figure. Shows the Memory Write cycle. In the Write operation, the 8085 places the
address and data and asserts the IO/ M signal. After allowing sufficient time for data to become
To interface memory with the microprocessor, we can summarize the above steps as
follows:
Figure: Timing of the Memory Write Cycle
1. Connect the required address lines of the address bus to the address of the memory chip.
2. Decode the remaining address lines of the address bus to generate the Chip Select signal, as
discussed in the next section and connect the signal to select the chip.
3. General control signals MEMR AND MEMW by combining RD and WR signals with
IO/ M and use them to enable appropriate buffers.
When any of these pins, except INTR, is active, the internal control circuit of the 8085
produces a CALL to a predetermined memory location. This memory location, where the
subroutine starts is referred to as vector location and such interrupts are called vectored
interrupts. The INTR is not a vectored interrupt. It receives the address of the subroutine from
the external device.
In 8085, all interrupts except TRAP are maskable. When logic signal is applied to a
maskable interrupt input, the 8085 is interrupted only if that particular input is enabled. These
interrupts can be enabled or disabled under program control. If disabled, 8085 disables an
interrupt request. The interrupt TRAP is nonmaskable whish means that it is not maskable by
program control. The figure shows the interrupt structure of 8085. The figure indicates that,
the 8085 is designed to respond to edge triggering, level triggering or both.
TRAP: This interrupt is a non maskable interrupt. It is unaffected by any mask or interrupt
enable. TRAP has the highest priority. TRAP interrupt is edge and level triggered. This means
that the TRAP must go high and remain high until it is acknowledged. This avoids false
triggering caused by noise and transients.
As shown in the figure, the positive edge of TRAP signal sets the D flip-flop. However,
due to the AND gate, it is necessary to sustain high level on the TRAP input. There are two
ways to clear TRAP interrupt:
By resetting microprocessor i.e. giving a low signal on RESETIN pin (External signal).
By giving a high TRAP ACKNOWLEDGE (Internal signal).
RST 7.5 : The RST 7.5 interrupt is a maskable interrupt. It has the second highest priority. As
shown in figure, it is positive edge triggered and the positive edge trigger is stored internally
by the D flip-flop until it is cleared by software reset using SIM instruction or by internally
generated ACKNOWLEDGE signal.
The positive edge signal on the RST 7.5 pin sets the D flip flop. If the mask bit M 7.5
is 0 i.e. RST 7.5 is unmasked then 8085 completes its current instruction. It then pushes the
address of the next instruction onto the stack and loads PC with the fixed vector address 003CH.
Due to this, 8085 starts execution of instructions from address 003CH which is the starting
address of an interrupt service routine for RST 7.5.
RST 6.5 and RST 5.5 : The RST 6.5 and RST 5.5 both are level triggered. These interrupts can
be masked using SIM instruction. The RST 6.5 has the third priority whereas RST 5.5 has the
fourth priority. The vector addresses of RST 6.5 and RST 5.5 are 0034H and 002CH
respectively. After recognition of RST 6.5 or RST 5.5 interrupt, 8085 completes its current
instruction; pushes the address of next instruction onto the stack and loads PC with
corresponding vector address.
INTR: INTR is a maskable interrupt, but not the vector interrupt. It has the lowest priority. The
following sequence of events occur when INTR signal goes high.
The 8085 checks the status of INTR signal during execution of each instruction.
If INTR signal is high, then 8085 completes its current instruction and sends an active low
In response to the
INTA
signal, external logic places an instruction OPCODE on the data
bus. In the case of multibyte instruction, additional interrupt acknowledge machine cycles are
generated by the 8085 to transfer the additional bytes into the microprocessor.
On receiving the instruction, the 8085 saves the address of next instruction on stack and
executes received instruction.
Note : Theoretically, the external logic can place any instruction code on the data bus in
response to the
INTA
. However, only CALL and RST codes save the contents of the PC on
the stack and branch program control to the subroutine address.
Response for RST instruction: If the external device places an opcode for any one of the RST
instruction (RST 0 – RST 7), then 8085 pushes the contents of PC onto the stack. It then
branches the program control to the vector address of the corresponding RST instruction.
Response for CALL instruction : If the external device places an opcode for CALL instruction
then 8085 generates two additional interrupt acknowledge cycles.
In response to second
INTA signal, external logic places the lower byte address for the
CALL instruction.
After receiving lower byte address, 8085 sends the third interrupt acknowledge signal.
In response to third
INTA signal, external logic places the higher byte address for the CALL
instruction.
After receiving sixteen bit address for CALL, 8085 pushes the contents of the PC onto the stack
and branches the program control to the subroutine whose address is received from the external
logic.
INSTRUCTION CYCLE
Instruction cycle is defined as the time required to complete the execution of an instruction.
MACHINE CYCLE
Machine cycle is defined as the time required to complete one operation of accessing memory,
I/O ,or acknowledging an external request.
T-STATE
T-state is defined as one subdivision of the operation performed in one clock period. T-state is
precisely equal to one clock period.
POLLING
In polling the microprocessor’s software simply checks each of the I/O devices every so often.
During this check the microprocessor tests to see if any devices need servicing.
1. Opcode fetch
2. Memory Read
3. Memory Write
4. I/O Read
5. I/O Write
6. Interrupt Acknowledge
7. Bus Idle.