GUI Manual · Chapter 16

Run Module

The Run Module is where the logic that drives the actual machine operation is gathered. When you expand a Run module in the Solution Explorer, it consists of Variable (module variables) · Functions (individual functions) · Sequence (the individual Step items within a sequence). Rather than editing the entire file at once, you add function and step nodes in the tree and then write only the code for the selected node in the editing tab.

Components

Variable

A node for declaring the variables used in the module. It gathers machine state values such as counts, flags, and target coordinates. Open the Variable node and declare them as follows.

xscript
int    cycleCount = 0;
bool   initOk = false;
double lastTargetX = 0.0;

Variable names must be unique within the module. If you rename one, references in that module's functions and steps are managed together.

Functions

A folder of individual function nodes that hold reusable logic. Hardware checks, common error handling, and initialization routines are typical examples. When you add a function via right-click FunctionsAdd Function, a function node is created and that function's editing tab opens. Write the function's code in the opened tab.

xscript
// Example content of the MoveToLoadPos function node
MOTOR["X"].MoveAbs(100.0, true);
MOTOR["Y"].MoveAbs(50.0, true);
return true;

Sequence

A folder that holds the machine's main state flow. During operation, the sequence's steps run in order, and only one step is active at a time. Add a step via right-click SequenceAdd Step.

Step

A detailed step node within a Sequence. Each step handles one state transition, and when you select a step, you edit only that step's code. Step nodes can be Rename · Move Up/Down · Delete via right-click, so you can rearrange the operation order directly in the tree.

Editing Flow

  1. Open the Variable node and declare the module variables.
  2. Right-click FunctionsAdd Function to add common functions and write their code.
  3. Right-click SequenceAdd Step to add steps one by one and describe the operation.
  4. Save and build with F6 (Save All & Make), then run the runtime with F5 (Run) to verify.

Tips

  • Splitting a step finely into about "one state transition" makes debugging easier.
  • Separate reusable logic into functions to avoid step duplication.
  • Function and step nodes can be renamed, moved, and deleted in the tree, so using clear, meaningful names makes the structure easy to understand and rearrange.