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 679Description:The syntax is:FOR count := initial_valueTO final_valueoptional { BY increment If you don’t specify an increment, the loopincrements by 1.DO;optionalIF bool_expression THENEXIT;END_IF;END_FOR;If there are conditions when you want toexit the loop early, use other statements,such as an IF...THEN construct, tocondition an EXIT statement.The following diagrams show how a FOR...DO loop executes andhow an EXIT statement leaves the loop early.Done x numberof times?yesDone x numberof times?yesnonostatement 1statement 1statement 2statement 2statement 3statement 3yesrest of the routinenorest of the routineThe FOR…DO loop executes a specificnumber of times.To stop the loop before the count reaches the lastvalue, use an EXIT statement.Arithmetic Status Flags:not affectedFault Conditions:A Major Fault Will Occur If Fault Type Fault Codethe construct loops too long 6 1Publication 1756-RM003I-EN-P - January 2007

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

Saved successfully!

Ooh no, something went wrong!