One time execution in ST code

2016-03-14
2016-03-14
  • manantrivedi77 - 2016-03-14

    Hi,

    In a ST, how can I run some part of code only once?

    In below example I need to run some part of the code ( commented with ( only once)) only once.

    IF a=1 Then

    IF b=1 THEN ( only once)
    c=1 ( only once)
    ELSEIF b=2 THEN ( only once)
    c=2 ( only once)
    END_IF

    CASE c OF
      1:
             ........
             ........
    
      2: 
             .........
             .........
    

    END_IF

     
  • shooter - 2016-03-14

    if (once=false) then
    once:=true;
    if b=1 then
    and rest of instructions.
    else
    end_if
    end_if

     

Log in to post a comment.