Suspends the current Cicode task for a specified number of milliseconds. After the time delay, the Cicode task wakes and continues execution. This function is similar to the Sleep function but with greater resolution.
Although a value of 0 milliseconds is accepted, it is not recommended. Try to use at least a value of 1.
This function does not affect any other Cicode tasks; only the task calling SleepMS() is suspended. If you have Cicode that runs continuously in a loop, you should call the SleepMS() or 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 milliseconds (1000 milliseconds per second). Set to 0 to pre-empt the task for one time-slice. Be careful not to use a value that is too small. Setting the value to 0 would generally have no desirable effect.
0 (zero) if successful, otherwise an error is returned.
TaskNew, ReRead, Sleep
Switch Bit ON and then OFF 500 milliseconds later.
! Increment a memory variable by ten, 120 times over one minute (twice a second).
I = 0;
WHILE I < 180 DO
iRamp = iRamp + 10;
I = I + 1;
! sleep a while in polling loops
WHILE < waiting for event or time> DO
! do what ever here
SleepMS(200); ! sleep a while to give other tasks a go.
! the longer the sleep the better for other tasks.