adapnex::core::TP

A pulse timer that generates a pulse with a defined pulse duration.

Synopsis

Declared in <adapnex/core/timer.h>

class TP;

Description

As soon as input IN becomes true, output Q becomes true and remains so for the full duration PT, irrespective of the state of IN.

TP Timing Diagram

Parameter Type Direction Description

IN

bool

Input

The rising edge triggers the start of the pulse.

PT

Duration

Input

The duration of the generated pulse.

Q

bool

Output

Becomes true immediately upon trigger and remains so for PT, ignoring IN.

ET

Duration

Output

The current elapsed time, incrementing while Q is active until it reaches PT.

Common Use Case

Triggering a specific mechanism such as a glue gun shot or ejector that requires a guaranteed active time.

Example: Ejector Trigger

class EjectorTask : public Task {
public:
    bool sensor_trigger = false;
    bool ejector_valve = false;

private:
    TP pulse_gen;

    void Update() override {
        // Fire ejector for exactly 50ms upon trigger.
        pulse_gen(sensor_trigger, 50ms, ejector_valve);
    }
};

Timers maintain internal state across cycles and must be instantiated as member variables of a task rather than local variables within Update().

Member Functions

Name

Description

operator()

Function call operators

Data Members

Name

Description

ET

As long as Q is true, the duration in ET is incremented until the value reaches PT. It then remains equal to PT.

IN

Input that triggers the start of the pulse.

PT

Input defining the duration of the pulse.

Q

Output that produces the defined pulse. If IN is false, the output Q is false. As soon as IN is true, Q becomes true and remains so for the duration PT, irrespective of the state of the input IN.

Created with MrDocs