Hi Guys!
I'm writing a Function Block and I want an internal counter to reset at the call of this FB.
Now I have searched at it seems I can't use the EN bit, as it is apparently not available. But the ENO bit is, and to me the EN and ENO should both be TRUE as soon as the FB is enabled?
The code I'm using is like this:
#Edge := ENO AND NOT #EN_OLD;
#EN_OLD := ENO;
IF #Edge = TRUE THEN
#ii := 0;
END:IF;
#Edge is a Temp Variable and #EN_OLD is a Static Variable.
It does not work, the counter stays at what ever value I have it on when enabling the FB.
If I change ENO to %I0.0, then it all works as expected.
Is there something I have misunderstood?
My goal is to avoid having a separate enabling input on the FB, but there may not be a way around it.
Best regards,
Michal
I'm writing a Function Block and I want an internal counter to reset at the call of this FB.
Now I have searched at it seems I can't use the EN bit, as it is apparently not available. But the ENO bit is, and to me the EN and ENO should both be TRUE as soon as the FB is enabled?
The code I'm using is like this:
#Edge := ENO AND NOT #EN_OLD;
#EN_OLD := ENO;
IF #Edge = TRUE THEN
#ii := 0;
END:IF;
#Edge is a Temp Variable and #EN_OLD is a Static Variable.
It does not work, the counter stays at what ever value I have it on when enabling the FB.
If I change ENO to %I0.0, then it all works as expected.
Is there something I have misunderstood?
My goal is to avoid having a separate enabling input on the FB, but there may not be a way around it.
Best regards,
Michal