Skip to content

Ladder Editor

The ladder editor is PiPLC's main programming environment — a visual workspace for creating and editing ladder logic programs.

Editor Layout

Area Location Function
Menu bar Top File, Edit, View, Runtime, GPIO, Tools, Help
Toolbar Top Quick actions and engine selector
Instruction palette Left Categorized instructions for drag & drop
Ladder editor Center Main workspace with program tabs
Properties panel Right Configuration of the selected element
Simulation panel Bottom Virtual I/O, watch panel, diagnostics
Engine selector Toolbar Create, select, and delete engine contexts

Editing Rungs

  • Add rung: Right-click context menu or toolbar button
  • Delete rung: Select and press ++delete++
  • Reorder rungs: Drag & drop
  • Comments: Each rung supports a title and multi-line comment
  • Numbering: Rungs have unique numbers per program
  • Undo/Redo: ++ctrl+z++ / ++ctrl+y++ for all operations

Adding Instructions

  1. Open the instruction palette on the left
  2. Drag an instruction onto a rung
  3. Configure its address in the properties panel (e.g., I:0/0, T:0, N:5)
  4. For timers and counters, set preset values

Tip

You can also right-click on a rung to insert instructions from a context menu.

Context Menu (Edit Mode)

Right-clicking anywhere on a rung shows a context-aware menu. The available actions depend on what you clicked on and whether you have a selection:

Action When it appears What it does
Insert Rung Here Always Inserts a blank rung at the right-clicked rung's position
Insert Rung After Always Inserts a blank rung below the right-clicked rung
Copy Rung Right-click on a rung Serializes the rung to the clipboard. Uses the same MIME type as ++ctrl+c++, so it interoperates with the standard copy/paste flow
Duplicate Rung Right-click on a rung Clones the rung via Rung::clone() and inserts the copy directly below
Paste Rung Before Right-click on a rung with a rung-shaped clipboard Inserts the clipboard rung(s) above the right-clicked rung
Insert Instruction ▸ Right-click on a rung Submenu with all instruction types
Insert Branch Right-click on a rung See "Wrap-in-Branch" below
Add Path to Branch Right-click on an existing branch Adds an empty parallel path to that branch
Delete Instruction Right-click on an instruction Deletes that single instruction
Delete Branch Path Right-click on a branch with > 1 path Deletes the path you clicked
Delete Branch Right-click on a branch Deletes the whole branch
Delete Rung Right-click on a rung Deletes the entire rung
Delete Selected A selection is active Deletes all selected items

Wrap-in-Branch

Insert Branch with no selection inserts an empty branch (two parallel paths) at the right-click position. With a selection, it wraps the selected elements inside a new branch — the selection becomes path 0 and path 1 is left empty for you to fill in.

The wrap works at any nesting depth as long as the selected items share the same parent container:

  • Several contacts at the rung level → wrapped at rung level.
  • Several contacts inside the same branch path → wrapped inside that path (a nested branch is created).
  • A graphically-enclosed inner branch is treated as a single unit when you select it together with its siblings.

Selections that span unrelated containers (e.g., one element at rung level and another inside a branch path) fall back to the previous "insert empty branch at the click location" behavior.

Undo (++ctrl+z++) reverses the wrap.

Right-click preserves selection

Opening the context menu with a right-click no longer clears your current selection — the blue highlight stays visible while the menu is open, so it's always clear which items the menu's actions will operate on.

Runtime Visualization

During simulation:

  • 🟢 Active rungs are highlighted in green
  • Wires show power flow (green = energized, gray = de-energized)
  • Current values are displayed next to contacts and coils
  • Timer/Counter instructions show ACC/PRE values in real time

Diagnostics Panel

The editor continuously validates the ladder structure:

  • ❌ Errors block execution
  • ⚠ Warnings are shown inline
  • Click a diagnostic to navigate to the affected rung