Passing Arguments to Parameters by Reference or by Value

The following information will help you understand the differences between passing argument tags to parameters by reference or by value.
AspectBy Value (Input or Output)By Reference (InOut)
ValueSynchronous - the argument's value does not change during Add-On Instruction execution.Asynchronous- the argument's value may change during Add-On Instruction execution. Any access by the instruction's logic directly reads or writes the passed tag's value.
PerformanceArgument values are copied in and out of the parameters of the Add-On Instruction. This takes more time to execute a call to the instruction.Parameters access argument tags directly by reference, which leads to faster execution of instruction calls.
Memory usageMost amount.Least amount.
Parameter data types supportedAtomic (SINT, DINT, INT, REAL, BOOL).Atomic, arrays, and structures.

0 comments :