Skip to content

Function blocks

eaxPLCReferenceFreeView as Markdown

The function blocks every ST program can instantiate without declaring them: the native blocks (implemented in Go, eaxPLC/pkg/plc/fb) and the library blocks written in ST. A program may declare its own block of the same name as an ST library block.

Block Kind Inputs Outputs
TON native 2 2
TOF native 2 2
TP native 2 2
CTU native 3 2
CTD native 3 2
CTUD native 5 3
SR native 2 1
RS native 2 1
SEMA native 2 1
R_TRIG native 1 1
F_TRIG native 1 1
RTC native 2 2
DERIVATIVE native 3 1
INTEGRAL native 3 2
LIN_TRAFO native 5 2
STATISTICS_INT native 2 3
STATISTICS_REAL native 2 3
VARIANCE native 2 1
PD native 10 2
PID native 10 5
PID_FIXCYCLE native 12 3
BLINK native 3 1
FREQ_MEASURE native 3 2
GEN native 6 1
CHARCURVE native 3 2
RAMP_INT native 5 1
RAMP_REAL native 5 1
HYSTERESIS native 3 1
LIMITALARM native 3 3

TON implements the standard IEC 61131-3 On-Delay Timer. Memory footprint: 24 bytes (fixed layout for persistent %M storage).

Kind: native. Instance size: 24 bytes. Source: eaxPLC/pkg/plc/fb/timers_counters.go

Pin Direction Type
IN input BOOL
Q output BOOL
PT input TIME
ET output TIME

TOF implements the standard IEC 61131-3 Off-Delay Timer.

Kind: native. Instance size: 24 bytes. Source: eaxPLC/pkg/plc/fb/timers_counters.go

Pin Direction Type
IN input BOOL
Q output BOOL
PT input TIME
ET output TIME

TP implements the standard IEC 61131-3 Pulse Timer. Memory footprint: 24 bytes.

Kind: native. Instance size: 24 bytes. Source: eaxPLC/pkg/plc/fb/standard_lib.go

Pin Direction Type
IN input BOOL
Q output BOOL
PT input TIME
ET output TIME

CTU implements the standard IEC 61131-3 Up-Counter.

Kind: native. Instance size: 20 bytes. Source: eaxPLC/pkg/plc/fb/timers_counters.go

Pin Direction Type
CU input BOOL
RESET input BOOL
PV input DINT
Q output BOOL
CV output DINT

CTD implements the standard IEC 61131-3 Down-Counter.

Kind: native. Instance size: 20 bytes. Source: eaxPLC/pkg/plc/fb/timers_counters.go

Pin Direction Type
CD input BOOL
LOAD input BOOL
PV input DINT
Q output BOOL
CV output DINT

CTUD implements the standard IEC 61131-3 Up/Down-Counter.

Kind: native. Instance size: 20 bytes. Source: eaxPLC/pkg/plc/fb/timers_counters.go

Pin Direction Type
CU input BOOL
CD input BOOL
RESET input BOOL
LOAD input BOOL
PV input DINT
QU output BOOL
QD output BOOL
CV output DINT

SR implements the IEC 61131-3 Set-Dominant Bistable function block. Q1 = (NOT RESET AND Q1) OR SET1

Kind: native. Instance size: 3 bytes. Source: eaxPLC/pkg/plc/fb/standard_lib.go

Pin Direction Type
SET1 input BOOL
RESET input BOOL
Q1 output BOOL

RS implements the IEC 61131-3 Reset-Dominant Bistable function block. Q1 = NOT RESET1 AND (Q1 OR SET)

Kind: native. Instance size: 3 bytes. Source: eaxPLC/pkg/plc/fb/standard_lib.go

Pin Direction Type
SET input BOOL
RESET1 input BOOL
Q1 output BOOL

SEMA implements the standard IEC 61131-3 Software Semaphore.

Kind: native. Instance size: 4 bytes. Source: eaxPLC/pkg/plc/fb/standard_lib.go

Pin Direction Type
CLAIM input BOOL
RELEASE input BOOL
BUSY output BOOL

R_TRIG implements the standard IEC 61131-3 Rising Edge Detector.

Kind: native. Instance size: 3 bytes. Source: eaxPLC/pkg/plc/fb/standard_lib.go

Pin Direction Type
CLK input BOOL
Q output BOOL

F_TRIG implements the standard IEC 61131-3 Falling Edge Detector.

Kind: native. Instance size: 3 bytes. Source: eaxPLC/pkg/plc/fb/standard_lib.go

Pin Direction Type
CLK input BOOL
Q output BOOL

RTC implements the standard IEC 61131-3 Real Time Clock function block. EN: Enable clock counting; PDT: Preset Date/Time in seconds; CDT: Current Date/Time.

Kind: native. Instance size: 32 bytes. Source: eaxPLC/pkg/plc/fb/standard_lib.go

Pin Direction Type
EN input BOOL
Q output BOOL
PDT input ULINT
CDT output ULINT

DERIVATIVE calculates the numerical derivative using 4-point approximation.

Kind: native. Instance size: 64 bytes. Source: eaxPLC/pkg/plc/fb/util_lib.go

Pin Direction Type
IN input REAL
TM input UDINT
RESET input BOOL
OUT output REAL

INTEGRAL calculates the numerical integral using trapezoidal rule.

Kind: native. Instance size: 32 bytes. Source: eaxPLC/pkg/plc/fb/util_lib.go

Pin Direction Type
IN input REAL
TM input UDINT
RESET input BOOL
OUT output REAL
OVERFLOW output BOOL

LIN_TRAFO transforms a REAL value from input range [IN_MIN..IN_MAX] to output range [OUT_MIN..OUT_MAX].

Kind: native. Instance size: 28 bytes. Source: eaxPLC/pkg/plc/fb/util_lib.go

Pin Direction Type
IN input REAL
IN_MIN input REAL
IN_MAX input REAL
OUT_MIN input REAL
OUT_MAX input REAL
OUT output REAL
ERROR output BOOL

STATISTICS_INT calculates standard statistical values (MN, MX, AVG) for INTs.

Kind: native. Instance size: 40 bytes. Source: eaxPLC/pkg/plc/fb/util_lib.go

Pin Direction Type
IN input DINT
RESET input BOOL
MN output DINT
MX output DINT
AVG output DINT

STATISTICS_REAL calculates standard statistical values (MN, MX, AVG) for REALs.

Kind: native. Instance size: 40 bytes. Source: eaxPLC/pkg/plc/fb/util_lib.go

Pin Direction Type
IN input REAL
RESET input BOOL
MN output REAL
MX output REAL
AVG output REAL

VARIANCE calculates running variance of REAL values.

Kind: native. Instance size: 40 bytes. Source: eaxPLC/pkg/plc/fb/util_lib.go

Pin Direction Type
IN input REAL
RESET input BOOL
OUT output REAL

PD implements a Proportional-Derivative controller.

Kind: native. Instance size: 56 bytes. Source: eaxPLC/pkg/plc/fb/util_lib.go

Pin Direction Type
ACTUAL input REAL
SET_POINT input REAL
KP input REAL
TV input REAL
Y_MANUAL input REAL
Y_OFFSET input REAL
Y_MIN input REAL
Y_MAX input REAL
MANUAL input BOOL
RESET input BOOL
Y output REAL
LIMITS_ACTIVE output BOOL

PID implements an industrial-grade IEC 61131-3 Proportional-Integral-Derivative controller.

Kind: native. Instance size: 88 bytes. Source: eaxPLC/pkg/plc/fb/pid.go

Pin Direction Type Also accepted as
SET_POINT input REAL SP
ACTUAL input REAL PV
KP input REAL
TN input REAL
TV input REAL
TD input REAL
Y_MIN input REAL LIM_L
Y_MAX input REAL LIM_H
MANUAL input BOOL
Y_MANUAL input REAL MANVAL
Y output REAL OUT
LIMITS_ACTIVE output BOOL LIM_ACT
P_Part output REAL
I_Part output REAL
D_Part output REAL

PID_FIXCYCLE implements a PID controller with fixed user-specified cycle time.

Kind: native. Instance size: 72 bytes. Source: eaxPLC/pkg/plc/fb/util_lib.go

Pin Direction Type
ACTUAL input REAL
SET_POINT input REAL
KP input REAL
TN input REAL
TV input REAL
Y_MANUAL input REAL
Y_OFFSET input REAL
Y_MIN input REAL
Y_MAX input REAL
MANUAL input BOOL
RESET input BOOL
CYCLE input REAL
Y output REAL
LIMITS_ACTIVE output BOOL
OVERFLOW output BOOL

BLINK generates a pulsating signal with configurable HIGH/LOW durations.

Kind: native. Instance size: 32 bytes. Source: eaxPLC/pkg/plc/fb/util_lib.go

Pin Direction Type
ENABLE input BOOL
TIMELOW input TIME
TIMEHIGH input TIME
OUT output BOOL

FREQ_MEASURE measures the frequency of a digital pulse train.

Kind: native. Instance size: 40 bytes. Source: eaxPLC/pkg/plc/fb/util_lib.go

Pin Direction Type
IN input BOOL
PERIODS input INT
RESET input BOOL
OUT output REAL
VALID output BOOL

GEN generates periodic waveforms (Triangle, Sawtooth, Square, Sine, Cosine).

Kind: native. Instance size: 32 bytes. Source: eaxPLC/pkg/plc/fb/util_lib.go

Pin Direction Type
MODE input INT
BASE input BOOL
PERIOD input TIME
CYCLES input INT
AMPLITUDE input INT
RESET input BOOL
OUT output INT

CHARCURVE performs piecewise linear interpolation across an array of POINTs.

Kind: native. Instance size: 52 bytes. Source: eaxPLC/pkg/plc/fb/util_lib.go

Pin Direction Type
IN input INT
N input USINT
P input ARRAY[0..21] OF INT
OUT output INT
ERR output USINT

RAMP_INT limits rate of change (ascend/descend slope) for integer signals.

Kind: native. Instance size: 32 bytes. Source: eaxPLC/pkg/plc/fb/util_lib.go

Pin Direction Type
IN input DINT
ASCEND input DINT
DESCEND input DINT
TIMEBASE input TIME
RESET input BOOL
OUT output DINT

RAMP_REAL limits rate of change (ascend/descend slope) for floating-point signals.

Kind: native. Instance size: 32 bytes. Source: eaxPLC/pkg/plc/fb/util_lib.go

Pin Direction Type
IN input REAL
ASCEND input REAL
DESCEND input REAL
TIMEBASE input TIME
RESET input BOOL
OUT output REAL

HYSTERESIS implements a dual-threshold Schmitt trigger comparator.

Kind: native. Instance size: 16 bytes. Source: eaxPLC/pkg/plc/fb/util_lib.go

Pin Direction Type
IN input DINT
HIGH input DINT
LOW input DINT
OUT output BOOL

LIMITALARM monitors whether an input value violates HIGH/LOW boundary limits.

Kind: native. Instance size: 16 bytes. Source: eaxPLC/pkg/plc/fb/util_lib.go

Pin Direction Type
IN input DINT
HIGH input DINT
LOW input DINT
O output BOOL
U output BOOL
IL output BOOL