Do not assume that multiple placements call one shared routine or reduce controller execution work. Choose macro boundaries for readability, minimize connection variables, remove obsolete macros, and verify the compiled resource report and timing on the controller.
Macro Execution Model
The available evidence describes a macro as either a supplied function block or a user-created function block. When the same logic is placed repeatedly, the compiler effectively includes the required logic for each instance. A macro therefore organizes the project but does not make several physical logic instances execute as one shared block.
Equivalent implemented logic should have equivalent execution performance whether it appears directly on the worksheet or is divided among macros. Macro names and page organization do not remove the operations required by each instance.
Selecting a Structure for the 12-Input Multiplexer
| Structure | Engineering consequence | Decision criterion |
|---|---|---|
| Six 2-input sections | Exposes smaller, easier-to-read logic sections. | Select when local signal flow and troubleshooting clarity are priorities. |
| Three 4-input sections | Reduces the number of top-level instances but repeats more logic inside each macro. | Select only if the resulting interface and internal drawing remain clearer. |
| Two 6-input sections | Uses the fewest top-level instances while concentrating repeated logic inside larger macros. | Select when the larger block remains understandable and does not require excessive connection variables. |
Do not select the two-macro arrangement merely because it has fewer macro symbols. If all three alternatives compile to the same logical operations, macro count alone does not establish a speed advantage. Compare readability, connection complexity, compiled resources, and measured execution behavior.
Project File Size Versus Controller Resources
The reported engineering project had grown to 14 MB while the compilation report showed Stack at 1%, ROM at 6%, and RAM at 3%. These values demonstrate that the engineering-file size and controller resource utilization are different measurements. A large project file does not, by itself, prove high controller memory consumption or slow execution.
One supported cause of unnecessary project growth is retaining old or unused macros. Remove obsolete macro definitions, then rebuild the project and review both the project-file size and the controller resource report separately.
Configuration Procedure
- Draw each candidate macro boundary around a complete, understandable function rather than selecting a boundary only to reduce the visible symbol count.
- Reduce variables used solely to represent connections where direct graphical connections remain readable.
- Delete old macro definitions that are no longer used, then rebuild the project.
- Compare the candidate structures using the compiler-reported Stack, ROM, and RAM utilization and test execution behavior in the real controller.
Do not design timing-dependent behavior around an assumed clock feature that is absent from this configuration.
Verification for a Time-Critical Application
Verify performance on the installed controller rather than relying only on a simulator. The evidence specifically warns that interference and controller-specific behavior may not be reproducible in simulation. Exercise the fastest relevant input changes, observe whether unintended pulses occur, and confirm that the selected multiplexer produces the required output without missed or spurious transitions.
Record the compiled Stack, ROM, and RAM values for each candidate. If equivalent structures produce no meaningful resource or measured timing difference, retain the version that is easiest to inspect and troubleshoot. For compressor control, complete this verification before allowing the controller to command pressure release, cooling, oil circulation, or other machine outputs.
FAQ
Does a PLC macro execute as one shared subroutine?
Not in the execution model described here. Each placed macro instance contributes its implemented logic, so multiple instances should not be treated as calls to one shared routine.
Will two 6-input macros run faster than six 2-input macros?
Not merely because there are fewer macro symbols. If both structures compile to equivalent operations, select between them using readability, connection complexity, compiled resource use, and controller timing tests.
Why is the project 14 MB when ROM use is only 6%?
The engineering-file size and controller resource utilization are separate measurements. Remove unused macros, rebuild, and evaluate the file size independently from the reported Stack 1%, ROM 6%, and RAM 3% values.