Skip to content

Tasks, Programs & Routines ​

Last updated

License feature: Ladder Logic

Ladder logic is organized in three levels:

LevelWhat it is
TaskOne independent scan loop with its own scan mode and period. Holds programs and a set of Task Tags shared by all its programs
ProgramA group of routines, e.g. one per machine or station. Has its own Program Tags. Can be switched off (unscheduled) without deleting it
RoutineA ladder routine (rungs) or an SFC chart. Each program has exactly one Main routine, which runs every scan; the others run only when a JSR calls them

The Ladder Logic page ​

Open Ladder Logic in the Visualize section of the sidebar. The page shows the safety notice, then Ladder Logic Tasks — one card per task, sorted by priority and then name.

Each card shows the task name, a Running or Stopped badge, the scan mode (Continuous or the period, e.g. 100ms) and, while running, Scan: … ms avg / … total. The buttons:

ButtonWhat it does
Play (Start) / Square (Stop)Starts or stops scanning (admins and editors; operators only when Operators can run this is ticked for the task)
Calendar (Schedule start/stop)Opens Schedules with a Start Ladder Task schedule filled in
Gear (Open Editor)Opens the editor
Trash (Delete)Asks Delete task "…"?, stops the task and deletes it with its programs, routines and SFC step tags. Shown to administrators only

Click the arrow at the left of a card to expand it: it lists Programs with a green (scheduled) or gray (off) dot and the routine count, Add Program and Edit, and the task's Event log — the 20 most recent starts, stops, resets, write errors, faults and recoveries, newest first, refreshed every 5 seconds.

Creating a task ​

  1. Click New Task.
  2. Task Name — e.g. Main Control Task.
  3. Scan Mode — Periodic (default) or Continuous.
  4. Period (ms) — for Periodic; default 100, minimum 10.
  5. Click Create. The editor opens.
  6. A new task has no programs. In the Routines panel click Add Program, type a name (e.g. Press1) and press OK. The program is created with a Main routine.
  7. Click Main, build your rungs, click Save, then Run.

Tip: Use Periodic at 100–500 ms for almost everything. The appliance reads most device tags every few hundred milliseconds anyway, so scanning faster gains nothing and costs CPU. See The Scan Cycle.

Task Settings ​

Click the gear next to the task name in the editor toolbar (Task Settings):

FieldDefaultEffect
Task Name—Renaming changes the SFC step tag paths (see SFC)
Description—Shown when the task card is expanded
Scan ModePeriodicPeriodic or Continuous. Applied at once, even while running
Period (ms)100Periodic only; values below 10 become 10
When the task is stoppedLeave outputs as they areLeave outputs as they are keeps every output at its last value, as a PLC does in program mode. Switch outputs off turns off every device output driven by an OTE or OTL coil, and everything an SFC chart drives, when someone stops the task. Saving a routine never triggers it. Make sure switching off is safe for the machine
Operators can run thisOffLets operators start and stop this task, from a dashboard button or the API. Off to begin with: starting a task drives real outputs. Admins and editors can always start and stop it
On a faultKeep scanning (alarm only)What a runtime fault does. Keep scanning retries on the next scan and raises a critical alarm; Stop the task halts it on the first fault. The scan watchdog, and losing the driver service on a task that uses real device I/O, stop the task either way — see Starting, Stopping and Faults
EnabledoffWhen ticked, the task starts automatically when the Scada.Ink service starts. It does not start or stop the task now

Click Save in the panel. Saving reloads the task (see Starting, Stopping and Faults).

Warning: A new task is created with Enabled off. A task you started with Run stays stopped after the appliance restarts unless Enabled is ticked.

Programs ​

In the editor's Routines panel, hover a program name to see:

  • the toggle — Disable scheduling / Enable scheduling. An unscheduled program shows (off) and is skipped entirely: its Main routine doesn't run and its tags aren't read. Its coils keep their last values;
  • the pencil — Rename program (type, then the tick or Enter);
  • the trash — Delete program (Delete program "…" and all its routines?; admin only).

Programs run in the order they were created, one after another in the same scan. There is no way to reorder them in the editor.

Routines ​

Under each program:

  • Add Routine — asks for a name (Routine name:) and adds an empty ladder routine.
  • Add SFC Chart — only with the Sequential Function Charts feature. See SFC.
  • Click a routine to open it. Main shows (Main); charts show SFC.
  • Hover a routine: pencil Rename routine; star Make Main routine (only when the open routine has no unsaved changes — Save this routine first); trash Delete routine (Delete routine "…"?, admin only). The Main routine cannot be deleted; make another routine Main first.

Warning: Renaming a routine does not update JSR elements that call it by name. The JSR shows "…" is not a routine in this program — the jump will do nothing. until you pick the new name.

Subroutines ​

  • Only a program's Main routine runs by itself.
  • A JSR element calls another routine in the same program when the rung has power at that point. The called routine runs completely, then the scan continues with the rung after the JSR.
  • RET ends a routine early when its rung has power.
  • SBR is just a marker; it does nothing.
  • Calls can nest up to 32 deep; deeper fails the scan with Call stack overflow (max 32).
  • A routine that isn't called in a scan isn't scanned at all: its coils keep their last values and its timers pause (see the timer notes in the Element Reference).

Starting and stopping from elsewhere ​

FromHow
A dashboardButton widget, action Ladder Task, Do What: Start scanning or Stop scanning
A workflowStart Ladder Task, Stop Ladder Task, Ladder Task Status nodes — see Input / Output Nodes
A scriptladder.start('Main Control Task'), ladder.stop(...), ladder.isRunning(...), ladder.status(...)
A time of daySchedules: Start Ladder Task / Stop Ladder Task

Details and permissions are in Starting, Stopping and Faults.

See also ​

Scada.Ink Help Center