TIME DELAY
FOR VARIOUS
8051 CHIPS
(cont’)
For 8051 system of 11.0592 MHz, find how long it takes to execute
each instruction.
(a) MOV R3,#55 (b) DEC R3 (c) DJNZ R2 target
(d) LJMP (e) SJMP (f) NOP (g) MUL AB
Solution:
Machine cycles Time to execute
(a) 1 1x1.085μs = 1.085μs
(b) 1 1x1.085μs = 1.085μs
(c) 2 2x1.085μs = 2.17μs
(d) 2 2x1.085μs = 2.17μs
(e) 2 2x1.085μs = 2.17μs
(f) 1 1x1.085μs = 1.085μs
(g) 4 4x1.085μs = 4.34μs

TIME DELAY
FOR VARIOUS
8051 CHIPS
Delay
Calculation
Find the size of the delay in following program, if the crystal
frequency is 11.0592MHz.
MOV A,#55H
AGAIN: MOV P1,A
ACALL DELAY
CPL A
SJMP AGAIN
;---time delay-------
DELAY: MOV R3,#200
HERE: DJNZ R3,HERE
RET
Solution:
Machine cycle
DELAY: MOV R3,#200 1
HERE: DJNZ R3,HERE 2
RET 2
Therefore, [(200x2)+1+2]x1.085μs = 436.255μs.
A simple way to short jump
to itself in order to keep the
microcontroller busy
HERE: SJMP HERE
We can use the following:
SJMP $

TIME DELAY
FOR VARIOUS
8051 CHIPS
Increasing
Delay Using
NOP
Find the size of the delay in following program, if the crystal
frequency is 11.0592MHz.
Machine Cycle
DELAY: MOV R3,#250 1
HERE: NOP 1
NOP 1
NOP 1
NOP 1
DJNZ R3,HERE 2
RET 2
Solution:
The time delay inside HERE loop is
[250(1+1+1+1+2)]x1.085μs = 1627.5μs.
Adding the two instructions outside loop we
have 1627.5μs + 3 x 1.085μs = 1630.755μs

TIME DELAY
FOR VARIOUS
8051 CHIPS
Large Delay
Using Nested
Loop
Find the size of the delay in following program, if the crystal
frequency is 11.0592MHz.
Machine Cycle
DELAY: MOV R2,#200 1
AGAIN: MOV R3,#250 1
HERE: NOP 1
NOP 1
DJNZ R3,HERE 2
DJNZ R2,AGAIN 2
RET 2
Solution:
For HERE loop, we have (4x250)x1.085μs=1085μs.
For AGAIN loop repeats HERE loop 200 times, so
we have 200x1085μs=217000μs. But “MOV
R3,#250” and “DJNZ R2,AGAIN” at the start and
end of the AGAIN loop add (3x200x1.805)=651μs.
As a result we have 217000+651=217651μs.
Notice in nested loop,
as in all other time
delay loops, the time
is approximate since
we have ignored the
first and last
instructions in the
subroutine

Post a Comment

0 Comments

Close Menu