Attention

These docs are a bit ambitious. The steps described are accurate but IronPLC cannot yet run programs.

Basic Usage

You can use the command line interface to check a file (and sets of files) for correctness.

Note

This section assumes you have installed the IronPLC Compiler. See Installation if you have not already installed the IronPLC Compiler.

Create a Project Directory

You’ll start by making a directory to store your IEC 61131-3 code. ironplcc doesn’t care where your code lives (and your code can be in multiple directories), but creating a directory will make it easy to work with your code.

Open a terminal and enter the commands in Create Project Directory to make the ironplc-hello-world directory.

Create Project Directory
mkdir ~/ironplc-hello-world
cd ~/ironplc-hello-world

Create an IEC 61131-3 Program

The next step is to create a source file for your IEC 61131-3 program. ironplcc doesn’t care what your call your file(s), but it will automatically detect file names with the .st extension as IEC 61131-3 programs.

In the same terminal, enter the commands in Create Hello World Program to create a program.

Create Hello World Program
echo "PROGRAM main
   VAR
      Button AT %IX1: BOOL;
      Buzzer AT %QX1: BOOL;
   END_VAR

   Buzzer := NOT Button;

END_PROGRAM

CONFIGURATION config
   RESOURCE res ON PLC
      TASK plc_task(INTERVAL := T#100ms, PRIORITY := 1);
      PROGRAM plc_task_instance WITH plc_task : main;
   END_RESOURCE
END_CONFIGURATION" > main.st

Check the Program for Correctness

Finally, in the same terminal, run the commands in Check Syntax to check your program’s syntax.

Check Syntax
ironplcc check main.st

The output OK should print to the terminal.

For now, that’s it. Presently, IronPLC does not create runnable programs.