BG Logic If/Then Timer

  • I have a background program running that makes sure I have suction and will stop the robot even if it loses signal for a a split second. I'm wondering how and if I can add like a 0.1 second timer to this line so RI [2] or [4] has to be off for longer than that to throw an alarm.


    If (DO[41]) and (!RI[2] OR !RI[4] AND !DO[40]) THEN

    UALM[1]


    Thanks

  • Well, you can't do timers in BG Logic but you can do math. You can do some thing like the following.


    BG Logic runs in cycles of 8ms (= 1/125s).


    R[x]=R[x]+1/125

    If R[x]>0.1 then "your code"


    Perhaps you need to add some flag as a condition to run the BG Logic whenever you'll execute it to reset the R[x].

Advertising from our partners