Attention

IronPLC supports IEC 61131-3 Structured Text excluding I/O mapping.

Build Tasks

The IronPLC extension integrates with the build system in your development environment to compile IEC 61131-3 projects from within the editor. This lets you compile your project to a bytecode container (.iplc) file without leaving your development environment.

Warning

The compile command currently supports only trivial programs. Supported features include: PROGRAM declarations, INT variable declarations, assignment statements, integer literal constants, and the + (add) operator. Programs using other features will produce a code generation error.

Running a Build

To compile the current project:

  1. Open the Command Palette (Ctrl+Shift+P or Cmd+Shift+P).

  2. Type “Run Build Task” and press Enter (or use the shortcut Ctrl+Shift+B / Cmd+Shift+B).

  3. Select ironplc: compile from the list of available tasks.

The extension runs ironplcc compile on the workspace folder and produces a .iplc file in the workspace root. The output file is named after the workspace folder (for example, a folder named myproject produces myproject.iplc).

Build output appears in the Terminal panel.

Setting as the Default Build Task

If you use the build task frequently, you can set it as the default so that Ctrl+Shift+B runs it directly without prompting.

  1. Open the Command Palette (Ctrl+Shift+P or Cmd+Shift+P).

  2. Type “Configure Default Build Task” and press Enter.

  3. Select ironplc: compile.

This creates a .vscode/tasks.json file in your workspace:

.vscode/tasks.json
{
  "version": "2.0.0",
  "tasks": [
    {
      "type": "ironplc",
      "task": "compile",
      "group": {
        "kind": "build",
        "isDefault": true
      },
      "label": "ironplc: compile"
    }
  ]
}

After configuring the default, pressing Ctrl+Shift+B compiles immediately.

See also

For command-line usage of the compiler, see Overview.