Interval from timer elapsed time

aarondw10
2022-10-17
2022-10-17
  • aarondw10 - 2022-10-17

    Hi,

    for a project I want to make a certain boolean X true, but only if the elapsed time of a TOF is between 2 specific values. (TOF goes up to 20 seconds).
    For example:

    IF T#4S <= timer.ET <= T#7S THEN
    X := TRUE;
    END_IF

    Now I keep getting the error that he can't do that. He can only compare the value of timer.ET to 1 specific time but not if the ET is between an interval of 2 times. Is their a different way to do it that doesn't make the code much larger?

    Thanks!

     
  • tvm - 2022-10-17

    Try this:

    IF (timer.ET >= T#4S) AND (timer.ET <= T#7S) THEN
        X:= TRUE;
    END_IF
    
     
    πŸ‘
    1

Log in to post a comment.