Lecture 37
Lecture 37
(H,L) 0
(B,C) N
(D,E) 0
(D,E) (D,E) + 1
(B,C) (B,C) - 1
(A) (B)
IS No
Z =1 ?
Yes
STOP
(D) N
(D) (D) - 1
IS No
(D) =0 ?
Yes
K ms Delay
(D) N
(D) (D) - 1
IS No
Z =1 ?
Yes
(B,C) (B,C) - 1
(A) (B)
IS No
Z=1?
Yes
Fig.6.10 Macro RTL Flow Chart to Introduce K ms Delay
While drawing the macro RTL flow chart of fig-14 it is assumed that
register pain (B, C), the register (D) and the accumulator (A) are
available to the user. The corresponding ALP for fig- 14 is shown in
fig.6.11.
: Number of states
: required for K=1
LXI B, K 10
LP2: MVI D, N 7
LP1: DCR D 4N
JNZ LP1 10(N-1)+7
DCX B 6
MOV A,B 4
ORA C 4
JNZ LP2 7
:
Fig.6.11 ALP to Introduce K ms Delay
The constant N can be calculated again to introduce 1msec delay.
The constant so calculated shall not differ from 8FH calculated in
problem -3 because only few extra instructions are involved in this
problem. However we shall calculate the value of N?
For K = 1, the delay is given by
Td = [10 + 7 + 4N + 10(N-1) + 7 + 6 + 4 + 4 + 7] T
= [14N + 35] T
In this case, outer loop will not be traversed at all.
Assuming T=0.5 μsec, i.e., 2MHz external clock
1x 10-3 = [14N + 35] x 0.5 x 106
or, 14N + 35 = 2 x 103
or, N = 140D = 8CH
K1 ms Delay
K2 ms Delay
K3 ms Delay
KDELAY: PUSH B
PUSH D
PUSH PSW
LP2: MVI D, 8CH
LP1: DCR D
JNZ LP1
DCX B
MOV A,B
ORA C
JNZ LP2
POP PSW
POP D
POP B
RET