Skip to main content

Structured Text Programming in WindLDR

By NFM Consulting 1 min read

Key Takeaway

How to write Structured Text programs in WindLDR for IDEC FC6A PLCs — syntax, data types, conditional logic, loops, and practical examples.

Quick Answer

WindLDR supports Structured Text (ST) as an IEC 61131-3 programming language for the FC6A. ST uses high-level text syntax for complex calculations, data manipulation, and sequencing algorithms that would be cumbersome in ladder diagram.

When to Use Structured Text

  • Complex math — Multi-step calculations, floating-point operations, and engineering unit conversions
  • State machines — Multi-step sequences using CASE statements
  • Data processing — Array operations, string handling, and data table manipulation
  • Algorithm implementation — Custom PID variants, statistical calculations, and protocol handling

Variable Declaration

VAR
    Pressure : REAL;
    PumpRunning : BOOL;
    StepNumber : INT;
    TankLevel : REAL := 0.0;
END_VAR

Conditional Logic

IF Pressure > 150.0 THEN
    HighPressureAlarm := TRUE;
    ShutdownValve := TRUE;
ELSIF Pressure > 120.0 THEN
    HighPressureWarning := TRUE;
ELSE
    HighPressureAlarm := FALSE;
    HighPressureWarning := FALSE;
END_IF;

CASE Statement for Sequencing

CASE StepNumber OF
    0: (* Idle *)
        IF StartCommand THEN StepNumber := 10; END_IF;
    10: (* Open inlet valve *)
        InletValve := TRUE;
        IF InletOpen THEN StepNumber := 20; END_IF;
    20: (* Start pump *)
        PumpStart := TRUE;
        IF PumpRunning THEN StepNumber := 30; END_IF;
    30: (* Running *)
        IF StopCommand THEN StepNumber := 0; END_IF;
END_CASE;

FOR Loop Example

TotalFlow := 0.0;
FOR i := 0 TO 9 DO
    TotalFlow := TotalFlow + FlowRate[i];
END_FOR;
AverageFlow := TotalFlow / 10.0;

For cross-platform comparison, see how Allen-Bradley handles Structured Text in Studio 5000.

Frequently Asked Questions

Ready to Get Started?

Our engineers are ready to help with your automation project.