PreviousNext
isDelay
Help > OS functions > Timing > isDelay

Function

 

Information whether the Delay timer has expired

Purpose

 

Time measurement or delay generation

Syntax

 

bit isDelay()

Parameters

 

  –

Return value

 

     1: Still in progress

     0: Elapsed

Output values

 

  –

Preconditions

 

startDelay or startLongDelay should be used before.

Remarks

 

     The (Long)Delay timer measures the specified time. The result is available via the isDelay function.

     Tip: the clrwdt instruction should be used to avoid unintentional watchdog reset during the delay.

     See Example E05–DELAYS.

Side effects

 

  –

See also

 

startDelay, startLongDelay

Example 1

 

     // LED on for 1 s

_LED = 1;

startDelay(100);      // Start 1 sec delay counting on OS background

while (isDelay())     // Wait until the delay is over

{

    clrwdt();         // Any useful operation on OS foreground can be

      ...             // performed during waiting

}

_LED = 0;             // Continue here after 1 sec

Example 2

 

     // LED on for 10 s

_LED = 1;

startLongDelay(1000); // Start 10 sec delay counting on OS background

while (isDelay())     // Wait until the delay is over

{

    clrwdt();          // Any useful operation on OS foreground can be

      ...             // performed during waiting

}

_LED = 0;             // Continue here after 10 sec