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...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

678 Structured Text ProgrammingFOR…DOUse the FOR…DO loop to do something a specific number of timesbefore doing anything else.Operands:Structured TextFOR count:= initial_value TOfinal_value BY increment DO;END_FOR;Operand Type Format Descriptioncount SINT tag tag to store count position as theFOR…DO executesINTDINTinitial_valueSINTINTtagexpressionmust evaluate to a numberspecifies initial value for countDINTimmediatefinal_valueSINTINTtagexpressionspecifies final value for count, whichdetermines when to exit the loopDINTimmediateincrementSINTINTtagexpression(optional) amount to increment counteach time through the loopDINTimmediateIf you don’t specify an increment, thecount increments by 1.IMPORTANTMake sure that you do not iterate within the loop too many times ina single scan.• The controller does not execute any other statements in theroutine until it completes the loop.• If the time that it takes to complete the loop is greater than thewatchdog timer for the task, a major fault occurs.• Consider using a different construct, such as IF...THEN.Publication 1756-RM003I-EN-P - January 2007

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

Saved successfully!

Ooh no, something went wrong!