Explainer
Why TwinCAT 3 has no hardware interrupt task call
Short answer
TwinCAT 3 has no digital-input hardware interrupt that calls a task. A task runs cyclically, freewheeling or on a TwinCAT event, and an edge on an EL1202 channel is none of those. Generate the ten gate edges with an oversampling output terminal or a fast cyclic task that owns the output refresh, and prove the spacing at the screw terminal.

On this page
If you moved to TwinCAT from a Siemens controller, the reflex is to loop the PWM output back into a high-speed input and let the rising edge call a hardware-interrupt organization block. TwinCAT 3 has no equivalent: a task runs cyclically, freewheeling or on a TwinCAT event, and a discrete input edge is not one of those triggers. The 1 µs response of the EL1202 describes how fast the terminal acquires an edge, not how fast your code reacts to it. For a thyristor gate train, generate the edges with an oversampling output terminal or a fast cyclic task that owns the output refresh, and prove the spacing at the screw terminal.
A task starts on a cycle or an event, never on an edge #
TwinCAT 3 real-time executes every task under a scheduler that assigns it a cycle time and a priority, and the task configuration offers three start conditions: freewheeling, cyclic, or triggered by an event. The event behind that third condition is a TwinCAT event raised in software; a voltage transition on an EtherCAT input channel is not a condition a PLC task can be bound to. There is no setting anywhere in the project tree that says "run this task on this input bit," so the Siemens pattern has no direct translation.
All of your code therefore still runs inside tasks scheduled in advance. The EL1202 edge can only appear as a bit in some task's input image, read one task pass after the bus cycle that carried it. This is architecture, not a missing parameter, so the fix is not a deeper configuration hunt but a different method of generating the pulse train.
What the 1 µs input rating does and does not promise #
The EL1202 is documented as a two-channel 24 V DC digital input terminal aimed at particularly fast signals, with 1 µs response. That figure is acquisition performance: the terminal detects the transition and carries it onto the EtherCAT bus almost immediately, which is exactly what you want when capturing an edge.
It is not a scheduling promise. The edge reaches your logic through the process image, and the process image is read when a task next executes, so the fastest possible reaction is bounded by the cycle time of the task that reads it, never by the terminal. A pulse narrower than the gap between two reads can vanish entirely — the same failure described in why a PLC misses short input pulses and how to catch them. The techniques there help you observe such pulses, but they do not turn an edge into a task call.
The firing-window arithmetic #
Take the target from the project: ten rising edges inside a 60° firing window on a 50 Hz line.
- Electrical period: 1000 ms ÷ 50 Hz = 20 ms
- Window: 20 ms × 60 ÷ 360 = 3.33 ms
- Edge spacing with the first edge on the zero crossing: 3.33 ms ÷ 9 ≈ 370 µs between edges
Against the 50 µs maximum PLC cycle the project assumes, that spacing is about seven scans per gap, so a cyclic task can place the edges in software. Each edge then carries up to one cycle time of quantization — 50 µs here — plus whatever the output refresh adds. Gate pulse trains tolerate that in most thyristor applications, because the train exists to keep retriggering the device until the anode current latches: pulse presence and spacing matter far more than sub-microsecond precision. The same arithmetic shows when software timing fails: at a 200 µs cycle the spacing leaves fewer than two scans per gap, and jitter destroys the pattern. That is the case where the decision moves to output hardware.
Two paths that generate the train #
A fast cyclic task that owns the outputs #
Run a cyclic task at a period well under that spacing — the fastest cycle your project sustains qualifies — and write the gate pattern from that task alone. Two settings make it work. First, outputs refresh is done by a task in TwinCAT, so the output-refresh allocation must point at the fast task; otherwise the pattern you compute reaches the field only when a slower task completes its pass, the same mechanism described in what the PLC scan cycle does in each pass. Second, enable a watchdog on that task, so a stalled or overloaded task drops the outputs instead of holding a gate on mid-window.
An oversampling output terminal #
An oversampling digital output such as the EL2262 separates edge placement from task timing altogether: the PLC writes a block of output states once per cycle, and the terminal steps through them at its own sample interval, faster than the PLC cycle, so the whole ten-edge pattern is placed without the task waking per edge. The supported sample interval, data format and buffering are specific to the terminal revision, so take them from the EL2262 documentation and confirm the intended cyclic task supplies the data every pass before you size the train.
Keep the EL3783 zero crossing as the reference in both paths: it marks when a firing window begins. It does not time the edges inside the window, and a crossing detected in software is subject to the same one-cycle latency as any input bit.
Prove the timing at the terminal #
Verify at the physical output, not in the logic. Scope one gate channel and one voltage channel through an isolated differential probe, trigger on a zero crossing, and measure the offset to the first edge, then edge to edge across the window. Record the offset, the spacing and their variation over 100 consecutive line cycles. Missing edges point to the output pattern or the refresh allocation; spacing that drifts by roughly one cycle time points to the task and argues for the oversampling path; a fixed offset on every window points to latency in the reference chain, which you trim in the firing-angle logic.
One safety note: a thyristor stack switches mains-voltage power, so a failed gate train dumps uncontrolled power into the load. Probe only with rated isolation, and treat any timing change as a change to live power electronics, not just to code.
Questions asked
Does TwinCAT 3 support event-triggered tasks at all?
Yes, but the trigger is a TwinCAT event raised in software, not a field signal. The task configuration offers freewheeling, cyclic and event-triggered starts, and an event-triggered task waits on that software event; it cannot be bound to a digital input channel. That channel's state still travels through the process image of whichever task reads it, one cycle after the edge.
What task period works for ten edges in a 60-degree window?
At 50 Hz the window is 3.33 ms and the edges sit roughly 370 microseconds apart with the firing edge on the zero crossing. A 50 microsecond cycle leaves about seven scans per gap, which is workable; a 200 microsecond cycle leaves fewer than two and the software path collapses. Bind output refresh to the fast task, enable its watchdog, and measure the real jitter at the output before trusting it.
Can the EL2502 PWM outputs already in the panel make the ten edges?
A PWM output terminal holds one frequency and one duty cycle that the task updates each cycle, so it produces a single controlled switching pattern per pass, not ten distinct edges inside one firing window. Keep those terminals for slow duty-cycle control, and put the gate train on an oversampling output terminal.


