Please ensure Javascript is enabled for purposes of website accessibility
Powered by Zoomin Software. For more details please contactZoomin

AVEVA™ Plant SCADA

Sleep

  • Last UpdatedJul 18, 2023
  • 1 minute read

Suspends the current Cicode task for a specified number of seconds. After the time delay, the Cicode task wakes and continues execution. If the sleep time is 0, the Cicode task is pre-empted for 1 time slice only.

This function does not affect any other Cicode tasks - only the task calling Sleep() is suspended. If you have Cicode that runs continuously in a loop, you should call the Sleep() function somewhere within the loop, to pause the loop and allow other tasks to run.

This function is a blocking function. It will block the calling Cicode task until the operation is complete.

Syntax

Sleep(Seconds)

Seconds:

The number of seconds. Set to 0 to pre-empt the task for one time-slice.

Return Value

0 (zero) if successful, otherwise an error code is returned.

TaskNew, ReRead, SleepMS

Example

Buttons

Text

Step

Command

PLCBit=1;Sleep(2);PLCBit=0;

Comment

Switch Bit ON and then OFF 2 seconds later

! Display "Hello" 10 times at 60 second intervals.

WHILE I < 10 DO

Sleep(60);

Prompt("Hello");

I = I + 1;

END

! Sleep a while in polling loops

WHILE < waiting for event or time> DO

! do what ever here

...

Sleep(10); ! sleep a while to give other tasks a go.

! the longer the sleep the better for other tasks.

END

See Also

Task Functions

In This Topic
Related Links
TitleResults for “How to create a CRG?”Also Available in