HARSFEN0602
… Do some work …
IsFirstFinished = 1 ; **Signal that some work is completed
The code of the second thread will include
… Prior to suspension code
until (IsFirstFinished) ; **The second thread suspended until
**signal
… Continue program.
If we want to suspend thread without terminating it, we can use until with a false expression.
5.5.5 Wait iteration
Syntax:
wait (expression ) ;
The wait keyword suspends the execution of the program until the specified time is elapsed.
The expression may be within round parentheses or without ones.
The expression specifies the waiting time in milliseconds. It can be numerical expression only,
which is evaluated in a single value.
Example:
PA=10000
BG
until (MS == 0)
wait (20) ; Wait 20 milliseconds
The above program instructs a PVT motion. The until (MS == 0) waits until the position command is
stabilized at the new position. The wait (20) allows additional 20 milliseconds for final stabilization.
5.5.6 IF condition
Syntax:
if( expression1 )
statement1
elseif ( expression2 )
statement2
else
statement3
end
The if keyword executes statement1 if expression1 is true (nonzero); if ifelse is present and expression2 is
true (nonzero), it executes statement2. The ifelse keyword may repeat scores of times during to if condition.
The statement3 will be executed only if all expression1, expression2, … expressionN
are false( or zero).