recondaddy
Member
I'm just learning about AOI's, and I have a question concerning Parameter Usage (Input, Output, or InOut).
I understand that Input and Output passes parameters in and out of the instruction BY VALUE, whereas InOut passes parameters BY REFERENCE. In the programming manual, I found a nifty table of considerations:
Value:
By Value: Synchronous - the Parameter's value does not change during Add-On Instruction execution.
By Reference: Asynchronous - the Parameter'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.
Performance:
By Value: Argument 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.
By Reference: Parameters access argument tags directly by reference, which leads to faster execution of instruction calls.
Memory usage:
By Value: Most amount.
By Reference: Least amount.
Parameter data types supported:
By Value: Atomic.
By Reference: Atomic, Arrays, and structures.
After looking at all these considerations, By Reference uses less memory, executes faster, and supports more data types than By Value. Why would I ever use Input or Output as opposed to InOut?
Thanks.
I understand that Input and Output passes parameters in and out of the instruction BY VALUE, whereas InOut passes parameters BY REFERENCE. In the programming manual, I found a nifty table of considerations:
Value:
By Value: Synchronous - the Parameter's value does not change during Add-On Instruction execution.
By Reference: Asynchronous - the Parameter'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.
Performance:
By Value: Argument 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.
By Reference: Parameters access argument tags directly by reference, which leads to faster execution of instruction calls.
Memory usage:
By Value: Most amount.
By Reference: Least amount.
Parameter data types supported:
By Value: Atomic.
By Reference: Atomic, Arrays, and structures.
After looking at all these considerations, By Reference uses less memory, executes faster, and supports more data types than By Value. Why would I ever use Input or Output as opposed to InOut?
Thanks.