Professional Documents
Culture Documents
Instruction cycle can be divided into a number of machine cycles by the MPU. And
machine cycle is divided into a number of T states by the MPU.
The common machine cycles are:
1. Opcode Fetch
2. Memory Read
3. Memory Write
4. I/O Read
5. I/O Write
1
Internal Data Bus
RD′
2
Next figure shows the timing of how a data byte is transferred from memory to the MPU; it
shows five different groups of signals in relation to the system clock. The address bus and data
bus are shown as two parallel lines. This is a commonly used practice to represent resent logic
levels of groups of lines: some lines are high and others are low. The crossover of the lines
indicates that a new byte (information) is placed on the bus and a dashed straight line indicates
the high impedance state. To fetch the byte, the MPU performs the following steps:
Step 1: The MPU places the 16-bit memory address from the PC on the address bus.
Next Figure shows that at T1 the high-order memory address 90, is placed on the address
lines A15 – A8, the low-order memory address 05 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 memory-
related operation.
Step 2: The control unit sends the control signal RD′ to enable the memory chip.
The control signal RD′ is sent out during the clock period T2, thus enabling the memory chip.
The RD′ signal is active during two clock periods.
Step 3: The byte from the memory location is placed on the data bus
When the memory is enabled, the instruction byte (4F) is placed on the bus AD7 – AD0
and transferred to the microprocessor. The RD′ causes 4F to be placed on bus AD7 – AD0
(shown by the arrow), and when RD′ goes high, 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 (4F) is decoded by the instruction decoder the contents of
the accumulator are copied into register C. This task is performed during the period T4 in Figure.
3
Opcode Fetch Machine Cycle
T1 T2 T3 T4
9005: 4F
A15
90 90
A8
AD7
05 4F
AD0
ALE
RD′
4
M1 (Opcode Fetch Machine Cycle)
T1 T2 T3 T4
9005: 3E
A15 9006: 57
90 90
A8
AD7
05 3E
AD0
ALE
RD′
5
M2 (Memory Read Machine Cycle)
T5 T6 T7
A15
90 90
A8
AD7
06 57
AD0
ALE
RD′
6
M1 (Opcode Fetch Machine Cycle)
T1 T2 T3 T4
9005: 32
A15 9006: 80
90 90
A8 9007: 95
AD7
05 32
AD0
ALE
RD′
7
M2 (Memory Read Machine Cycle)
T5 T6 T7
A15
90 90
A8
AD7
06 80
AD0
ALE
RD′
Timing Diagram of the Instruction: STA 9580 (continued from and to)
8
M3 (Memory Read Machine Cycle)
T8 T9 T10
A15
90 90
A8
AD7
07 95
AD0
ALE
RD′
Timing Diagram of the Instruction: STA 9580 (continued from and to)
9
M4 (Memory Write Machine Cycle)
A15
95 90
A8
AD7
80 (A)
AD0
ALE
WR′
10
Commonly used Machine cycles in 8085 are:
Some Instructions with Machine Cycles and T-states are shown below:
Instruction No. of Bytes Machine Cycles Total No. of T states
MOV A, B 1 OF(4) 4
MOV A, M 1 OF(4) MR(3) 7
MOV M, A 1 OF(4) MW(3) 7
INR C 1 OF(4) 4
DCR C 1 OF(4) 4
INR M 1 OF(4) MR(3) MW(3) 10
DCR M 1 OF(4) MR(3) MW(3) 10
INX H 1 SF(6) 6
DCX H 1 SF(6) 6
11
Find total time to execute following program if Microprocessor Clock Frequency is 2 MHz.
LXI B 0203
MVI A 00
ADD B
ADD C
STA 9000
HLT
Find total time to execute following program if Microprocessor Clock Frequency is 3 MHz.
LXI B 0203
MVI A 00
ADD B
ADD C
STA 9000
HLT
12
COUNTER AND TIME DELAYS:
Steps:
A counter is designed simply by loading appropriate number into one of the registers and
using INR or DNR instructions
Loop is established to update the count.
Each count is checked to determine whether it has reached final number; if not, the loop
is repeated.
Time Delay procedure is used to design a specific delay. A register is loaded with a number,
depending on the time delay required and then the register is decremented until it reaches zero by
setting up a loop with conditional jump instruction
Find total time to execute following program if Microprocessor Clock Frequency is 2 MHz.
Method 1:
Method 2:
13
Time Delay using a Register Pair:
10 + (6+4+4+10)*65535−3 = 1572847
[So if we use this delay routine 2 times, we can generate a delay of about 1 second]
14