WAIT expression |
WAIT |
| expression | in | Expressions of BOOL type. |
; assignment with delay U.Int := 1 ; value assignment WAIT ; waiting for the assignment |
; if the action WAIT is successful (no error), |
; the value of the object U.Int is certainly 1 IF U.Int = 1 THEN ; value test ; the branch THEN-ELSE is executed whenever the value of the object U.Int is 1 ELSE ; the branch ELSE-ENDIF won't be never executed |
ENDIF |
U.Int := 2 ; In this case there is not guaranteed that the value of the object U.Int will be 2 ; it depends on the current system load ... IF U.Int = 1 THEN ELSE ENDIF |
M.Cmd of I/O tag type,
output integer type.
INT _maxWriteCount = 10 ; maximal count of writings
INT _writeCount ; writing counter
ON ERROR WriteFailed ; error handle
_writeCount := 0
WriteRetry:
IF _writeCount >= _maxWriteCount GOTO WriteLoopFailed
_writeCount := _writeCount + 1
M.Cmd := 1
WAIT
; Successful writing
END
; Writing failed _maxWriteCount-times
WriteLoopFailed:
END
; unsuccessful writing handle
WriteFailed:
GOTO WriteRetry |
In case of assigning a selection, then this is controlled as the whole. Every fractional writing must be well executed. Such a situation occurs, for the assignment of a value of structure type, if references to objects are in individual items.
SD.Rec contains one item of
Integer type with the name Int and two items of Object type
with the names s Obj1 and
Obj2.
The structure type of the object SV.Rec of
Structured variable type is SD.Rec and its row number is 2.
There are the objects M.1, M.2, M.3, M.4 - output I/O tags of Integer
type.
RECORD NOALIAS (SD.Rec) _locArr ; local variable of Structure type
; disables references to objects
REDIM _locArr[2] ; resizing the array length |
; assignment of values to the local variable of Structure type |
_locArr[1]^Int := 1 _locArr[1]^Obj1 := 1 _locArr[1]^Obj2 := 2 _locArr[2]^Int := 2 _locArr[2]^Obj1 := 3 _locArr[2]^Obj2 := 4 |
; assign references to the objects SET SV.Rec[1] ^Obj1 AS M.1 SET SV.Rec[1] ^Obj2 AS M.2 SET SV.Rec[2] ^Obj1 AS M.3 SET SV.Rec[2] ^Obj2 AS M.4 WAIT ; execution of the reference change in the system |
P1: SET SV.Rec AS _locArr ; assignment of the whole value WAIT |