Skip to content

Common Ladder Patterns ​

Last updated

License feature: Ladder Logic

B_…, N_… and F_… are Program Tags; tags with a path are Device Tags.

Start/stop seal-in ​

  • XIC Start_PB with a parallel branch holding XIC Line1/Motor_Cmd → XIO Stop_PB → XIC Overload_OK → OTE Line1/Motor_Cmd

Pressing Start energizes the motor command; the branch contact on the command itself keeps the rung true after Start is released, until Stop or the overload breaks it. Because it is an OTE, the command drops when the task stops if When the task is stopped is Switch outputs off.

Start/stop with a latch ​

The same circuit with latch and unlatch rungs, useful when the run state must survive a restart:

Rung 1:  ─┤ Start_PB ├──────────────(L) B_Motor_Run
Rung 2:  ─┤/ Stop_PB_NC ├───────────(U) B_Motor_Run
Rung 3:  ─┤/ Overload_OK ├──────────(U) B_Motor_Run
Rung 4:  ─┤ B_Motor_Run ├───────────( ) Line1/Motor_Cmd
  • Rung 1: XIC Start_PB → OTL B_Motor_Run.
  • Rung 2: XIO Stop_PB_NC (a normally-closed stop button is on while not pressed) → OTU B_Motor_Run.
  • Rung 3: XIO Overload_OK → OTU B_Motor_Run.
  • Rung 4: XIC B_Motor_Run → OTE Line1/Motor_Cmd on Local Tags.

Because the unlatch rungs come after the latch rung, Stop wins if both buttons are pressed. The run bit is retentive: after a restart the motor command comes back on if it was on — add a rung that unlatches it on start-up if that is not acceptable.

OR logic ​

Put the conditions on parallel branches: XIC Door1_Open with a branch XIC Door2_Open → OTE B_AnyDoorOpen.

Without branches, give each condition its own latch rung, then one unlatch rung with all conditions false:

  • Rung 1: XIC Door1_Open → OTL B_AnyDoorOpen
  • Rung 2: XIC Door2_Open → OTL B_AnyDoorOpen
  • Rung 3: XIO Door1_Open → XIO Door2_Open → OTU B_AnyDoorOpen

For numeric 0/1 values an OR block also works: OR N_Door1 with N_Door2 into N_Any, then NEQ N_Any ≠ 0.

Safety interlock chain (for HMI permissive only) ​

  • XIC EStop_OK → XIC Guard_Closed → XIC Air_Pressure_OK → OTE Line1/Ready
  • Any contact going false drops Ready. This is an indication for operators, not a safety function — the real interlock belongs in safety-rated hardware.

Latched alarm with acknowledge ​

  • Rung 1: GRT Furnace/Temp > Literal 450 → OTL Furnace/HighTempAlarm (Local Tags)
  • Rung 2: XIC Furnace/AckPB → LES Furnace/Temp < Literal 440 → OTU Furnace/HighTempAlarm

The second compare stops an acknowledge from clearing the alarm while the temperature is still high, and gives 10 °C of hysteresis.

Resettable batch counter ​

  • Rung 1: XIC Infeed/PartSensor → CTU Address C5:0, Preset 50
  • Rung 2: XIC C5:0/DN → OTE Line1/BatchComplete
  • Rung 3: MOV Source C5:0.ACC → Line1/PartCount (Local Tags)
  • Rung 4: XIC Line1/BatchResetPB → RES C5:0

The Local Tags count is only written when it changes. The same with integer math:

  • Rung 1: OSR Infeed/PartSensor → ADD Source A N_Parts + Literal 1 → Destination N_Parts → MOV N_Parts → Line1/PartCount (Local Tags)
  • Rung 2: GEQ N_Parts ≥ Literal 50 → OTE Line1/BatchComplete
  • Rung 3: XIC Line1/BatchResetPB → CLR N_Parts → MOV Literal 0 → Line1/PartCount

The OSR makes the ADD happen once per part, and the MOV to Local Tags runs only when the count changes — not every scan.

Run-hour meter ​

An RTO with an address accumulates while the spindle runs and RES clears it after a service: RTO T4:1 (Preset large, e.g. 1800000000 ms), then GEQ T4:1.ACC ≥ Literal 1800000000 → OTE Spindle/ServiceDue, and XIC Spindle/ServiceDonePB → RES T4:1.

Or make a self-resetting one-minute pulse and count the pulses:

  • Rung 1: XIO B_Pulse → XIC Spindle/Running → TON Preset (ms) 60000 → OTE B_Pulse
  • Rung 2: XIC B_Pulse → ADD Source A N_RunMinutes + Literal 1 → Destination N_RunMinutes
  • Rung 3: GEQ N_RunMinutes ≥ Literal 30000 (500 h) → OTE Spindle/ServiceDue (Local Tags)
  • Rung 4: XIC Spindle/ServiceDonePB → CLR N_RunMinutes

On the scan the TON finishes, B_Pulse turns on and rung 2 adds a minute; on the next scan the XIO opens, the TON resets and B_Pulse turns off. Each minute lasts one scan longer than 60 s, which is negligible. If the spindle stops part-way through a minute, that part-minute is lost. N_RunMinutes is saved every 10 s.

Debounced input ​

  • XIC Tank/LevelSwitch → TON Preset (ms) 2000 → OTE B_LevelHigh_Debounced

The output only turns on after the switch has been on continuously for 2 s, and drops as soon as it opens. For an off-delay too, follow with a TOF.

Analog scaling and a threshold ​

  • Rung 1: SCP Input Boiler/Pressure_Raw, Input 6400–32000, Output 0–10, Destination F_PressureBar
  • Rung 2: GRT F_PressureBar > Literal 8.5 → OTE B_PressureHigh
  • Rung 3: OSR B_PressureHigh → OTL Boiler/PressureHigh (Local Tags)
  • Rung 4: OSF B_PressureHigh → OTU Boiler/PressureHigh

Rungs 3 and 4 write the Local Tags tag only on the scan the internal bit changes, instead of on every scan — the cheap way to publish a result for a dashboard or an alarm.

Timed step sequence (without SFC) ​

  • Rung 1: XIC B_Step1 → TON Preset (ms) 5000 → OTU B_Step1 → OTL B_Step2
  • Rung 2: XIC B_Step2 → OTE Mixer/Agitator (Local Tags)

When the TON finishes, the same rung ends step 1 and starts step 2; on the next scan XIC B_Step1 is false and the timer resets. For more than two or three steps, use an SFC chart.

See also ​

Scada.Ink Help Center