Program example

These are examples of programs in the code editor.
Situation
Example
Program with parameters
Program programWithParam(
Input timer inputParameter { pre := 3; },
Output dint outputParameter) {
extern routine main();  // defined in another file
}
Unscheduled program declared in controller application 
ControllerApp ctrlApp() {
    // program instance not in task - unscheduled
    unschedledProgram;
    // program forward declare to program 
    // implementation declared in another file
    extern program unschedledProgram();
}
Scheduled program declared in controller application
ControllerApp ctrlApp() {
    // program instance in task – scheduled
    Task mainTask {
        schedledProgram;
    }
    // program forward declare to program 
    // implementation declared in another file
    extern program schedledProgram();
}
Scheduled program declared in a Smart Object
ControllerApp ctrlApp() {
    // program instance in task – scheduled
    Task mainTask {
        Area.Tank101.inlet.pumpProgram;
    }
}
program MainProgram() {
tag bool boolTag;
routine ld main() {
xic(boolTag); {
Desc := “some rung description”;
}
}
}
Program programWithParam(
Input timer inputParameter { pre := 3; },
Output dint outputParameter) {
Extern routine main(); // defined in another file
}
Provide Feedback
Have questions or feedback about this documentation? Please submit your feedback here.