Skip to content

Error with Not FB

Hi, i wanted to implement a block that would set the value of a variable to True and after 5ms it would be False and then after 5ms again it would be True. I have attempted doing that using the FBs as shown below. But, after a while the value is stuck at True and the Not FB does not invert the input. Is there a workaround for this?

Comments

  • It's unlikely that the NOT function is behaving incorrectly.
    I'm guessing that the variables are toggling on each execution cycle. In that case, you won't see every transition in the Debug window, and you might see inconsistent variable states in the Debug window.
    Have you tried setting a breakpoint on that section of code, and stepping through it to see the behaviour on successive execution cycles?
  • It's unlikely that the NOT function is behaving incorrectly.
    I'm guessing that the variables are toggling on each execution cycle. In that case, you won't see every transition in the Debug window, and you might see inconsistent variable states in the Debug window.
    Have you tried setting a breakpoint on that section of code, and stepping through it to see the behaviour on successive execution cycles?

    My issue is that the output Q is stuck at "True" at all times even though ive looped it back and tried to invert it so it resets to false and back to true after sometime. I noticed that this is the always the case when i restart the PLC. is there perhaps a different function block that can serve as an alternative to what im trying to do?
  • I can't reproduce that problem.
    The code below works for me, even after I restart the PLC.
    The program instance is executing in a Cyclic task with an interval of 10ms.

  • I can't reproduce that problem.
    The code below works for me, even after I restart the PLC.
    The program instance is executing in a Cyclic task with an interval of 10ms.


    my interval was 100ms but after changing it to 10ms the values stopped resetting again after 2 seconds.
  • Can you confirm that the code I posted (exactly as I posted it) stops working on your PLC after 2 seconds?

    Can you please check the Output.log file for any messages that might indicate what the problem is?
Sign In or Register to comment.