Attention
IronPLC supports IEC 61131-3 Structured Text excluding I/O mapping.
How a PLC Program Works¶
Before writing your first program, it helps to understand how a PLC application is structured. This chapter introduces the core idea that every PLC program is built around.
The Sense-Control-Actuate Cycle¶
Controllers operate in a continuous sense-control-actuate cycle:
Sense — read inputs from sensors (buttons, temperature probes, etc.).
Control — evaluate logic to decide what to do.
Actuate — write outputs to actuators (buzzers, motors, valves, etc.).
The runtime repeats this cycle on a fixed schedule — for example, every 100 milliseconds. Each repetition is called a scan cycle.
A Doorbell Example¶
A simple doorbell system illustrates the cycle. The system has a button (the sensor) and a buzzer (the actuator):
Pressing the button triggers the buzzer.¶
In each scan cycle, the PLC:
Senses whether the button is pressed.
Controls — decides the buzzer should sound when the button is pressed.
Actuates — turns the buzzer on or off.
Note
A real doorbell does not need a PLC. This example is deliberately simple to illustrate how PLC programs work.
What You Will Build¶
In this tutorial, you will write a doorbell program and progressively enhance it:
Write the control logic in Structured Text, the programming language defined by IEC 61131-3.
Run it directly from the editor and inspect the results.
Configure the application with a task schedule.
Connect it to hardware inputs and outputs.
Let’s start writing code.
Continue to Your First Program.