12.07.2015 Views

Logix5000 Controllers General Instructions - SLAC Confluence

Logix5000 Controllers General Instructions - SLAC Confluence

Logix5000 Controllers General Instructions - SLAC Confluence

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Structured Text Programming 685The following diagrams show how a REPEAT...UNTIL loop executesand how an EXIT statement leaves the loop early.statement 1statement 1statement 2statement 2statement 3BOOL expressionfalsetruerest of the routinestatement 3noBOOL expressionfalseyestruerest of the routineWhile the bool_expression is false, thecontroller executes only the statements within theREPEAT…UNTIL loop.To stop the loop before the conditions are false, usean EXIT statement.Arithmetic Status Flags:not affectedFault Conditions:A Major Fault Will Occur If Fault Type Fault Codethe construct loops too long 6 1Example 1:If You Want ThisThe REPEAT...UNTIL loop executes the statements in theconstruct and then determines if the conditions are true beforeexecuting the statements again.This differs from the WHILE...DO loop because the WHILE...DOThe WHILE...DO loop evaluates its conditions first. If theconditions are true, the controller then executes thestatements within the loop. The statements in aREPEAT...UNTIL loop are always executed at least once. Thestatements in a WHILE...DO loop might never be executed.Enter This Structured Textpos := -1;REPEATpos := pos + 2;UNTIL ((pos = 101) OR(structarray[pos].value = targetvalue))end_repeat;Publication 1756-RM003I-EN-P - January 2007

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!