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;
  bEnableAT%IX2.0 : BOOL;
  bitstateAT%QX2.0 : BOOL;END_VARVARRETAIN
  bStarted : BOOL;END_VAR
  IFbStarted=FALSETHEN
    blinker.TIMEHIGH :=t#1s;
    blinker.TIMELOW :=t#1s;
    bStarted :=TRUE;
  END_IF
  blinker.ENABLE :=bEnable;
  bitstate :=blinker.outANDbEnable;
The docs for BLINK make it look like a pretty simple FB to implement, so am I missing something totally obvious?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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:
The docs for BLINK make it look like a pretty simple FB to implement, so am I missing something totally obvious?
Looks like you aren't actually calling the function block, just initializing it's parameters.
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;
Thanks a bunch, guys.