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.

682 Structured Text ProgrammingThe following diagrams show how a WHILE...DO loop executes andhow an EXIT statement leaves the loop early.BOOL expressiontruefalseBOOL expressiontruefalsestatement 1statement 1statement 2statement 2statement 3rest of the routinestatement 3noyesrest of the routineWhile the bool_expression is true, thecontroller executes only the statements withinthe WHILE…DO loop.To stop the loop before the conditions are true, use anEXIT 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 WHILE...DO loop evaluates its conditions first. If theconditions are true, the controller then executes thestatements within the loop.This differs from the REPEAT...UNTIL loop because theREPEAT...UNTIL loop executes the statements in the constructand then determines if the conditions are true beforeexecuting the statements again. 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 := 0;While ((pos

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

Saved successfully!

Ooh no, something went wrong!