Beckhoff First Scan Bit |work|

Because the variable is declared with RETAIN , it will preserve its FALSE state across subsequent program starts, until a full power cycle. If you need it to trigger on every STOP->RUN transition, you would declare it without the RETAIN keyword, which forces a TRUE initialization on each warm start.

The First Scan Bit is an internal Boolean variable that acts as a one-shot trigger. It acts as the signal that the PLC program has just loaded into memory and is beginning its first cycle of execution. Key Characteristics: It is TRUE on the very first cycle.

TwinCAT is built on an IEC 61131-3 compliant real-time kernel. Because it runs on standard PC hardware and manages tasks via an abstract software layer, the concept of a "cold start" or "warm start" hardware contact does not natively apply in the same way it does to dedicated hardware controllers. beckhoff first scan bit

In TwinCAT 2, developers frequently monitored the SystemInfoCtrl or utilized standard system flags. However, for TwinCAT 3, is highly preferred due to its independence from specific system task architectures and superior portability across different hardware targets (ARM vs. x86/x64).

: The official Tc3_Standard provides a clean helper: Because the variable is declared with RETAIN ,

Using _TaskInfo ensures that if you have multiple tasks (e.g., a fast cycle for motion, slow for HMI), you are checking the specific task that is starting.

IF FirstScan THEN // Force all digital outputs OFF myDigitalOutput := FALSE; // Set analog output to 0V/0mA myAnalogOutput := 0; It acts as the signal that the PLC

If you have nested function blocks, they won't automatically know a "first scan" occurred in the main program.

Have a specific first scan challenge? Visit the Beckhoff Community forums or consult your local Beckhoff support engineer.

The FB_FirstScan function block monitors the system’s cycle counter and reliably returns TRUE for exactly one cycle after application start, even if multiple programs call the same FB instance.