Table Of Contents

Loop Timing

Version:
    Last Modified: March 28, 2017

    Loop timing refers to how long a loop takes to execute a single iteration. The amount and type of code a loop contains affects its execution speed.

    By default, each loop iteration executes as quickly as possible based on the code inside the loop. However, you might want to change the execution speed of a loop for one or more of the following reasons.

    Reason to Control Loop Timing Example Application Procedure
    You want to repeat the code inside a loop and specify a fixed time interval for each iteration. Take a temperature measurement every 10 minutes. Adjusting the Execution Speed of a Loop
    You want to reduce the execution speed of a loop to make the result of each iteration more easily visible, as seen through indicators on the panel. Control the rate at which data values are plotted to a chart.
    Instead of allowing a loop to execute at full speed, potentially taking full control of all of the CPU's resources, you want to conserve processing resources for other tasks. Yield control of the CPU to allow other threads, such as serial or VISA calls, access to processor resources while the loop waits.
    You want to synchronize the execution of multiple loops. Two loops contain sections of code that take different amounts of time to run. Synchronize these loops to the system clock so that they begin each iteration at the same time. Synchronizing the Execution of Multiple Loops

    Recently Viewed Topics