verarbeitung-flip-flop

hio/nwt-gus-hi/verarbeitung-flip-flop

Permanently holds either 0 or 1
verarbeitung-flip-flop
@/verarbeitung-flip-flop
Permanently holds either 0 or 1
Startpulse
Setzt den gespeicherten Wert auf 1
Schalterpulse
Schaltet den gespeicherten Wert von "true" auf "false", bzw. 1 auf 0. Oder von "false" auf "true", bzw. 0 auf 1.
Neustartpulse
Startet den Node neu mit dem Wert 0.
verarbeitung-flip-flop
Start
Schalter
Neustart
Ergebnis
Ergebnisboolean
Ausgegebener boolescher Wert. Kann "true" , 1 oder "false" , 0 sein.
To use the node in your project you should have the hio/nwt-gus-hi library installed. Use the “File → Add Library” menu item in XOD IDE if you don’t have it yet. See Using libraries for more info.

C++ implementation

node {
    void evaluate(Context ctx) {
        bool oldState = getValue<output_Ergebnis>(ctx);
        bool newState = oldState;

        if (isInputDirty<input_Neustart>(ctx)) {
            newState = false;
        } else if (isInputDirty<input_Start>(ctx)) {
            newState = true;
        } else if (isInputDirty<input_Schalter>(ctx)) {
            newState = !oldState;
        }

        if (newState == oldState)
            return;

        emitValue<output_Ergebnis>(ctx, newState);
    }
}

Tabular tests

SETTGLRSTMEM
no-pulseno-pulseno-pulsefalse
pulseno-pulseno-pulsetrue
no-pulsepulseno-pulsefalse
no-pulsepulseno-pulsetrue
no-pulseno-pulseno-pulsetrue
no-pulseno-pulsepulsefalse
no-pulseno-pulsepulsefalse
pulsepulsepulsefalse
pulsepulsepulsefalse
pulsepulseno-pulsetrue
pulsepulseno-pulsetrue
no-pulsepulseno-pulsefalse