Use of delay loops, Computer Engineering

Assignment Help:

A very useful application of assembly is to generate delay loops. These loops are used for waiting for some time before execution of subsequent instruction.

However how to find time for the delay? The rate at which instructions are executed is determined by clock frequency. Every instruction occupies a certain number of clock cycles to execute. This multiplied by clock frequency of microprocessor gives actual time of execution of an instruction. For illustration MOV instruction occupies four clock cycles. This instruction when run on a microprocessor with a 4 MHz clock occupies 4/4 which means 1 microsecond. NOP is an instruction which is used to produce the delay without affecting actual running of program.

Time-delay of 1 ms on a microprocessor having a clock frequency of 5 MHz will necessitate:

1419_Use of delay loops.png

Thus, a 1-millisecond delay will require:

1588_Use of delay loops1.png

The subsequent program section can be used to produce the delay with counter value correctly initialised.

MOV CX, N    ; 4 clock cycles N will vary depending on

                        ; The amount of delay required

DELAY:         NOP                ; 3 cycles

                        NOP                ; 3 cycles

                        LOOP DELAY; 17 or 5

LOOP instruction occupies 17 clock cycles when condition is true and 5 clock cycles otherwise. Condition will be true 'N' number of times and false just once when control comes out of loop.

To calculate 'N':

  Total clock cycles    = clock cycles for MOV + N (2*NOP clock cycles + 17) - 12 (when CX = 0)

5000 = 4 + N (6 + 17) - 12 

 N = 5000/23 = 218 = 0DAh

So the counter CX must be initialized by 0DAh in order to get delay of 1 millisecond.


Related Discussions:- Use of delay loops

Name the concepts of object oriented, Name the concepts of Object oriented ...

Name the concepts of Object oriented There are various concepts of object oriented analysis Abstraction, Encapsulation, Identity, Modularity, Hierarchy, Typin

Performance of caches - computer architecture, Performance of caches: ...

Performance of caches:       Amdahl's Law regarding overall speed up:                  Alternatively, CPU stall can be considered:

Advantage of booth and restoring division algorithm, Describe the advantage...

Describe the advantage of using Booth algorithm? Ans:  a) It achieves efficiency in the number of additions needed when the multiplier has a few large blocks of 1's. b) It

Explain about synchronous dram, Q. Explain about Synchronous DRAM? One ...

Q. Explain about Synchronous DRAM? One of the most broadly used forms of DRAM is synchronous DRAM (SDRAM). Unlike the conventional DRAM that is asynchronous SDRAM exchanges dat

What is FIFO, What is FIFO? FIFO is used as buffering element or queui...

What is FIFO? FIFO is used as buffering element or queuing element into the system that is by common sense, is needed only while you slow at reading than the write operation.

Design goals of computer system, Design goals: The correct form of a c...

Design goals: The correct form of a computer system depends on the constraints and aim for which it was optimized. Computer architectures frequently trade off   cost, standard

Analysis the pc configuration, 1) Identify the software needs of each PC an...

1) Identify the software needs of each PC and whether or not anything needs to change. a. State the changes that you would make (and why) b. If no "change" needs to be made b

Create a scatterplot for each set of variables, For each of the following v...

For each of the following variables: YEARofBIRTH transformed into a new variable called . To do this you will need to use the Command. Hint codes 9998 and 9999 are missin

The concept of thread-parallel computing, The Concept of Thread Thread ...

The Concept of Thread Thread is a chronological flow of control within a process. A process can include one or more threads. Threads have their own register values and program

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd