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

What is performance testing in loadrunner, Timing for both read and update ...

Timing for both read and update transactions should be gathered to verify whether system functions are being performed in an acceptable timeframe. This should be done standalone an

Clustering-coefficient- artificial intelligence, This programming assignmen...

This programming assignment is about computing topological properties of Protein-Protein Interaction (PPI) networks. Recall that a PPI network is represented by a graph G=(V,E) whe

Logical difference among move a to b and compute b = a, What is the  logic...

What is the  logical difference among Move A TO B and COMPUTE B = A ? Ans) In case of Move A TO B it will move whatever the value of a in to b. It mean it will move nume

Explain working of d flip -flop, Q. Explain working of D Flip -Flop? D ...

Q. Explain working of D Flip -Flop? D (data) flip-flop is modification of RS flip-flop. Problem of undefined output in SR flip-flop when both R and S become 1 gets avoided in D

Java program , Q.--> The program simulates a student management system havi...

Q.--> The program simulates a student management system having thE following:The interface uses command buttons to (i) add,edit,delete,update and cancel the records, (ii) to naviga

Determine grade of service is given worse service or not, The larger the Gr...

The larger the Grade of Service, the worse is the service given, it is true or false. Ans: It is true that larger the Grade of Service, the worse service is provided.

When page fault frequency in an operating system is reduced, Page fault fre...

Page fault frequency in an operating system is reduced when the? When locality of reference is appropriate to the process so Page fault frequency in an operating system is redu

What are the features of prom, What are the features of PROM? They are ...

What are the features of PROM? They are programmed directly by the user. Faster Less expensive More Flexible

8259 PIC, plz expalain interfacing of 8259 with 8085 step wise

plz expalain interfacing of 8259 with 8085 step wise

Explain about the various features present in ms access, Microsoft access h...

Microsoft access has vast advantages for a programmer and end user. Some of the advantages are ? Relative compatibility with SQL and VBA. ? Microsoft SQL server desktop engi

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