omron — TAS real-valued function

TAS real-valued function TAS real-valued function Syntax TAS (variable, new_value) Function Return the current value of a real-valued variable and assign it a new value. The two actions are done indivisibly so that no other program task can modify the variable at the same time. Usage Considerations The eV+ system does not enforce any protection scheme for global variables that are shared by multiple program tasks. It is the programmer's responsibility to keep track of the usage of such global variables. The TAS real-valued function (or the similar CAS function) can be used to implement logical interlocks on access to shared variables.

This function can also be used to work around a restriction on the simultaneous access of global arrays by multiple program tasks -- program execution can fail if two or more tasks attempt to increase the size of an array at the same time. For a detailed description of this, see the "Global Array Access Restriction" section of the information about Arrays, in the eV+ Language User's Guide . Parameters variable Name of the real-valued variable to be tested and assigned the new value given.

(If the variable is not defined when the function is executed, the function returns the value 0.) new_value Real value, variable, or expression that defines the new value to be assigned to the specified variable. Details Because the different program tasks execute simultaneously, time-sharing the system processor, it is possible for any task to be interrupted by another in the middle of performing some computation or storing data into variables. When data is shared by two or more tasks, the programs must implement an interlock scheme to prevent the data from being accessed when it is only partially updated.

The TAS function can be used to allow multiple eV+ tasks to modify shared data structures. That is, the function provides a way for a task to lock out others while the locking task modifies the data structures. Note that without the TAS function, a much more complicated polling scheme would be needed to administer the control variable (i.e., to prevent more than one program from setting the control variable simultaneously). eV+Language Reference Guide, v2.x, 18319-000 Rev A Page 521