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.
The number of seconds. Set to 0 to pre-empt the task for one time-slice.
0 (zero) if successful, otherwise an error is returned.
TaskNew, ReRead, SleepMS
Switch Bit ON and then OFF 2 seconds later
! Display "Hello" 10 times at 60 second intervals.
WHILE I < 10 DO
I = I + 1;
! 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.