Attention
IronPLC can only run very simple programs. The steps described are accurate but many language features are not yet supported.
Structure a Multi-File Project¶
This guide gives practical advice on organizing an IEC 61131-3 project across multiple files. IronPLC does not enforce any particular layout — use whatever makes sense for your project.
Note
This guide assumes you have installed the IronPLC Compiler. See Installation if you have not already installed it.
A Recommended Starting Layout¶
For small to medium projects, a flat structure works well:
my-project/
├── config.st # Configuration, resource, and task definitions
├── main.st # Main program
├── utilities.st # Reusable functions and function blocks
└── globals.st # Global variable lists (if needed)
Separating Configuration from Logic¶
Keep your CONFIGURATION block in its own file. This makes it easy to
create different configurations for testing and production:
my-project/
├── config-production.st # Production configuration (100ms cycle)
├── config-test.st # Test configuration (different timing)
├── main.st
└── utilities.st
When checking with IronPLC, pass the appropriate configuration:
ironplcc check main.st utilities.st config-production.st
Checking a Directory¶
If all your .st files are in one directory, you can point IronPLC
at the directory instead of listing every file:
ironplcc check my-project/
IronPLC finds all .st files in the directory and checks them
together.
One POU per File¶
As your project grows, consider putting each program, function, or function block in its own file named after the POU:
my-project/
├── config.st
├── main.st
├── motor_control.st # FUNCTION_BLOCK MotorControl
├── temperature_monitor.st # FUNCTION_BLOCK TemperatureMonitor
└── clamp.st # FUNCTION Clamp