Simplifying interfaces with structs/UDTs
Structures (structs/UDTs) can be declared in the following interface scopes:
- Input
- Output
- InOut
- Temp
- Static
Structures cannot be declared as either of the following:
- Constant
- Return
With this in mind, structures can be used to help simplify interfaces with program blocks. They can also help multiple blocks come together to access different parts of common data.
Passing inputs as a single struct
Passing data in and out of function blocks can help keep the complexity of the program object to a minimum, as shown here:
Figure 3.12 demonstrates how using a struct could minimize the size of the interface used with the Structure_Pass_Example_FB
function block. By accessing the data block that is holding the instance data for the function block, the Input
interface data can be accessed and written to...