Studio 5000: Main Task with Multiple Programs & Routines
In Studio 5000, a Main Task can contain multiple Programs. Each Program has a MainRoutine and
may include several Subroutines.
If all Programs are part of the Main Task:
- Each Program's MainRoutine runs continuously.
- They run one after the other, in the order they appear in the task.
- Once all have run, the loop repeats immediately.
Example with 4 Programs in Main Task:
1. Program_A -> MainRoutine -> (calls Subroutine_A1, A2... if included)
2. Program_B -> MainRoutine -> (calls Subroutine_B1, B2... if included)
3. Program_C -> MainRoutine -> (calls Subroutine_C1, C2... if included)
4. Program_D -> MainRoutine -> (calls Subroutine_D1, D2... if included)
Execution Cycle:
[Program_A MainRoutine] -> [Program_B MainRoutine] -> [Program_C MainRoutine] -> [Program_D
MainRoutine] -> REPEAT
Subroutines:
- Subroutines do NOT run on their own.
- They must be explicitly called using the JSR (Jump to SubRoutine) instruction inside a
MainRoutine.
- If called, they execute every time the MainRoutine runs.
Summary Table:
| Component | Runs Repeatedly | Triggered Automatically | Notes |
|------------------|------------------|--------------------------|--------------------------------------|
| Program MainRoutine | Yes | Yes | Runs in sequence, inside Main Task |
| Subroutine | If called | No | Must be called using JSR |
Think of it like chefs (Programs) working in shifts (Tasks) in a kitchen:
Each chef follows their main recipe (MainRoutine) and may use helper steps (Subroutines).
They take turns in order and repeat the process non-stop.