ST Editor

The ST editor provides a full-featured environment for writing IEC 61131-3 Structured Text programs.

It supports autocomplete, inline diagnostics, online editing, and direct integration with UniLogic tags.

ST Editor Basics

The ST editor supports standard editing features:

Working in the ST Editor

  1. To create a Structured Text function, right-click a module in the Solution Explorer and select Add ST Function.

  2. UniLogic adds the function and opens the ST editor. The function appears with an ST icon; you can right-click it to rename.

  3. Add FunctionIn/Out/Local tags to define the function interface.

  4. Write code below the (*User code starts below this comment) line.

  5. Use autocomplete: begin typing a tag or function name and click when it appears. 

  6. Drag & drop the ST function to the Ladder, and link tags to contain the values.

  7. Download and run the program.

 

Including Global Tags

To access global tags inside an ST function without passing them as parameters:

  1. In the Properties Window, click Used Globals.

  2. Start typing the global tag name and select it from the list.

  3. Click Close. The tag is added as VAR_EXTERNAL and available in code.

  4. In the editor, start typing the tag name and click to insert it.

 

Variable Creation On-the-Fly

You can create variables directly from the ST editor by right-clicking any identifier in the code. The context menu options depend on whether the identifier is new or already exists elsewhere in the project.

  1. Right-click a new identifier to open the context menu.

  2. Select the required option:

If the identifier already exists as a global tag in the project, additional options are available:

        

Variable creation is supported during online editing. The editor will prompt for the type.

 

Parameter Hints (Overload Window)

The ST editor displays parameter hints while typing function calls to help you enter parameters correctly, view available overloads, and identify the expected parameter types. 

  1. Hovering over a parameter displays the variable scope, data type, and variable name.

  2. Auto-complete suggests tag names and function keywords as you type; press Enter or click to accept.

  3. Selecting a function from the autocomplete list opens the hints window automatically, highlighting the currently edited parameter.

  4. Alternatively, typing ( after a valid function name opens the hints window. Pressing Esc or typing ) closes the window.

  5. Use the arrow keys to navigate through available overloads.

  6. Named parameters (NAME := value) appear in autocomplete and update the highlight.

Functions with Multiple Overloads

Function

Notes

BITS_TO_NUM 

Variable number of bit inputs

NUM_TO_BITS

Variable number of bit outputs

ARRAY_FIND

Optional start index parameter

ARRAY_MAX

Optional range parameters

ARRAY_MIN

Optional range parameters

ARRAY_SORT 

Optional direction parameter

 

Online Editing in QuickSync Mode

The ST editor supports editing while the controller is in Online + QuickSync Mode, consistent with how Ladder is edited online.

Editing local variable values online is not supported - only declarations.

 

Note that any edits made during Quick Sync are not incorporated into the project until you save the project (File > Save or Ctrl+S).

 

Online Diagnostics

When connected online, the ST editor displays live variable values directly in the code view.

 

Display Behavior

Type

Online Display

BOOL 

TRUE or FALSE inline

TIME

Formatted (e.g., 5s, 1h30m)

DATE_AND_TIME

Human-readable (e.g., 2025-06-01-08:30:00)

INT / REAL

Numeric value

STRING

String value in quotes

 

  • Tag search is case-insensitive

  • Global tags appear in burgundy; local tags in black

  • TIME values can be entered online without the T# prefix 

 

Related Topics

ST Language Reference

ST Function Library

IEC Function Blocks