I/O in an User Defined Type (UDT)



A User Defined Type (UDT) / structure is allocated as a contiguous block of memory. It Provides best performance for copy and message read/write operations. Because of this you cannot have an alias within a structure. While this would be nice from a design standpoint, it would have a detrimental impact on performance. Copy and Message operations would require significant overhead to detect the alias and perform the lookup of disjointed tag data.

Recommendations:

If you need an I/O value in a UDT, define the UDT with a member to store the I/O value and buffer the I/O value into/out-of the UDT.
·     Make sure data-type of UDT member and I/O are the same type (avoids data type conversion)
·     Load input values into the UDT at the top of the program and copy output values out of the UDT at the bottom of the program
·     Single Bit – Use Examine on (XIC) and Output coil (OTE)
·     Contiguous bits – Use Bit Field Distribute (BTD) instruction
·     Single Value – Use Copy (COP) Instruction
·     Multiple Contiguous values – Utilize Synchronous Copy (CPS) instruction
·     Side benefit of providing synchronous I/O to program in that UDT, values will not change during the program scan

Q: How can you tell that a tag has not been used?
A: In tag editor select Show Unused tags to limit the view (filter) to tags that have not been referenced.

 

Q: How can I tell if a bit in a tag, element of an array, or member of a structure has not been used?
A: Run a cross-reference on root tag of the tag sort the list by reference or base tag and then look for gaps in the tags sequence.

Comments

Popular Posts

Short Speech on Independence Day in Malayalam

Eye Directive Wheelchair

5g