Welcome to our new forum
All users of the legacy CODESYS Forums, please create a new account at account.codesys.com. But make sure to use the same E-Mail address as in the old Forum. Then your posts will be matched. Close

Flip-Flop Schaltung

wofi
2019-01-28
2019-01-28
  • wofi - 2019-01-28

    Hallo zusammen,
    ich bin neu hier im Forum und beschäftige mich jetzt mit codesys und Beckhoff Steuerungen mit RPI.
    Komme ganz gut damit zurecht,aber ich brauchte mal Hilfe beim programmieren einer Flip-Flop Schaltung.
    D.h. mit einem Eingang setze ich einen Ausgang auf ein und beim nächsten drücken des Eingangs den Ausgang wieder auf aus.

    Für jede Hilfe wäre ich sehr dankbar.

     
  • wofi - 2019-01-28

    wofi hat geschrieben:
    Hallo zusammen,
    ich bin neu hier im Forum und beschäftige mich jetzt mit codesys und Beckhoff Steuerungen mit RPI.
    Komme ganz gut damit zurecht,aber ich brauchte mal Hilfe beim programmieren einer Flip-Flop Schaltung.
    D.h. mit einem Eingang setze ich einen Ausgang auf ein und beim nächsten drücken des Eingangs den Ausgang wieder auf aus.
    Für jede Hilfe wäre ich sehr dankbar.

     
  • Lo5tNet - 2019-01-28

    There might be a function block already doing this but here is a quick way to accomplish this.

    VAR
        xInputPressed : BOOL;  //Input that the button is tied to
        fb_ButtonPressedTrig : R_TRIG;
        xOutputActive : BOOL; //Output to be turned on/off
    END_VAR
    fb_ButtonPressedTrig(CLK:= xInputPressed);
    IF fb_ButtonPressedTrig.Q THEN
        xOutputActive := NOT xOutputActive;
    END_IF
    

    This was quickly written up and not tested so there might be an error but this hopefully gets you there.

     

Log in to post a comment.