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

BLINK function block

SteveP
2007-07-19
2007-07-23
  • SteveP - 2007-07-19

    Hi guys,

    I'm wanting to flash a stack light, and it looked like the BLINK function block in util.lib was a perfect fit for that. Alas, I am getting no blinkage when setting ENABLE to true. ST code as follows:

    VAR
       blinker : BLINK;
       bEnable AT %IX2.0 : BOOL;
       bitstate AT %QX2.0 : BOOL;
    END_VAR
    VAR RETAIN
       bStarted : BOOL;
    END_VAR
       IF bStarted = FALSE THEN
          blinker.TIMEHIGH := t#1s;
          blinker.TIMELOW := t#1s;
          bStarted := TRUE;
       END_IF
       blinker.ENABLE := bEnable;
       bitstate := blinker.out AND bEnable;
    

    The docs for BLINK make it look like a pretty simple FB to implement, so am I missing something totally obvious?

     
  • ndzied1 - 2007-07-22

    Looks like you aren't actually calling the function block, just initializing it's parameters.

     
  • dhinakaran - 2007-07-23

    YES

    You will have to call the Function block then it will work...

    CODE:

    BLK(ENABLE:=start , TIMELOW:=t#0.5S , TIMEHIGH:=t#0.5s , OUT=>Status );

    Variable:

    BLK: BLINK;

    start: BOOL;

    Status:BOOL;

     
  • SteveP - 2007-07-23

    Thanks a bunch, guys.

     

Log in to post a comment.