Write a delay function in assembly using NOP that takes 1mse

Write a delay function in assembly, using NOP that takes 1msec to complete.

Solution

using 8051 microcontroller

1 machine cycle will have 1.085us execution time

mov ro,#230         ; 1 machine cycle * 1

loop1: nop             ; 1 machine cycle * 230

           nop             ; 1 machine cycle   * 230

          djnz r0,loop1   ; 2 machine cycle * 230

result : total machine cycles = 4 * 230 + 1 = 921

           so generated delay = 921 * 1.085us

                                          = 1ms

Write a delay function in assembly, using NOP that takes 1msec to complete.Solutionusing 8051 microcontroller 1 machine cycle will have 1.085us execution time m

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site