We can provide Delay in 8051 micro-controller by using "MOV" instructions and by using timer. Here we describe the procedure for Delay using "MOV" instruction.

Every instruction takes it's own time (in terms of Machine Cycles) to execute. We can write instruction in such a manner that time required to execute those instructions is nearly equal to the required Delay time. General steps for writing Delay Subroutine is given as follows:

                  MOV R3, #23

Here1:     MOV R2, #255

Here2:     MOV R1, #255

Here:       DJNZ R1, Here

                 DJNZ R2, Here2

                 DJNZ R3, Here1


This piece of subroutine will provide delay in seconds. Amount of Delay which will be provided by this code depends on the content of R3, R2, R1. Again, the values to be filled into R3, R2, R1 Depends on the required Delay.

(Note: We will use more registers if required. If after calculation some Registers value is 0, then we will not use corresponding line in the code.)

Following videos further describe the procedure for calculating delay subroutine in more detail.

(Note: In case of any error in calculation please contact us by filling form given below)

For More Information
Ph. : 0120-2663236
mob: +91-9971776373
e-mail: info@jcbrolabs.org
or Fill Quick Enquiry Form

© 2021 by JCBRO LABS

  • w-facebook
  • Twitter Clean
  • w-googleplus
  • w-youtube