Sleep (Function)

Top  Previous  Next

Architecture:

X32 / NX32 / NX32L

Device support:

All

Firmware version:

1.00 / 1.00.00


Sleep is a simple function that will take the specified number of milliseconds to complete before it returns control to the caller. This is a quick way of introducing delays in a program. However, a cleaner and better way is often to use one of the different timers available, such as the TON timer.

 

Input:                

delay : INT (0..32767)

Number of milliseconds to wait before returning.

 

Returns:

None.

 

Declaration:

FUNCTION Sleep;
VAR_INPUT
  delay : INT;
END_VAR;

 

 

Example:

INCLUDE rtcu.inc
 
PROGRAM test;
 
BEGIN
  ...
  // Wait 1000 mSec (1 second)
  Sleep(delay := 1000);
  ...
END;
 
END_PROGRAM;