Timers & Signal Generators

The Adapnex SDK provides a suite of deterministic timing blocks and signal generators. These classes are pure C++, modeled after the IEC 61131-3 industrial standard. Developers with industrial automation experience will find the logic familiar, while benefiting from C++ type safety and deterministic execution.

These blocks manage time delays, pulse durations, and periodic signals. Because they maintain internal state across cycles, they are designed to be instantiated as member variables of a Task and invoked cyclically within Update().

Overview of Available Blocks

The table below summarizes the timing and signal generation blocks available in the SDK. Detailed timing diagrams, parameter tables, and runnable examples for each block are documented on their respective reference pages linked in the table.

Block Type Behavior Summary Common Use Case

TON

On-delay timer

Delays the rising edge of a signal by a preset duration

Sensor debouncing, delayed startup

TOF

Off-delay timer

Delays the falling edge of a signal by a preset duration

Cooling fans, run-on delays

TP

Pulse timer

Generates a pulse of fixed duration regardless of input pulse length

Actuators, ejectors, dispensing valves

ClockGenerator

Pulse generator

Emits a single-cycle pulse at periodic intervals

Periodic data logging, heartbeats

SquareWaveGenerator

Signal generator

Generates an oscillating signal with configurable ON and OFF durations

Flashing indicator lights, reciprocating motion

Best Practices

  1. Task Member Instantiation: Always declare timing blocks as member variables of your Task class. Function blocks maintain internal state across cycles and will reset every cycle if declared locally inside Update().

  2. Duration Units: Use standard C++ duration literals from <chrono> (such as 100ms, 5s, or 1min) for preset time parameters (PT, PTON, PTOFF).

  3. Elapsed Time Monitoring: Inspect the public ET (Elapsed Time) member on any timer block to monitor how much time has elapsed in the active cycle.