EasyManuals Logo
Home>Allen-Bradley>Controller>Studio 5000 Logix Emulate

Allen-Bradley Studio 5000 Logix Emulate User Manual

Allen-Bradley Studio 5000 Logix Emulate
676 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #660 background imageLoading...
Page #660 background image
Chapter 11
660 Rockwell Automation Publication MOTION-RM002H-EN-P-February 2018
Example 1
If you want this Enter this structured text
The REPEAT_UNTIL loop executes the statements in the construct and then
determines if the conditions are true before executing the statements again. This
differs from the WHILE_DO loop because the WHILE_DO The WHILE_DO loop
evaluates its conditions first.
If the conditions are true, the controller then executes the statements within the
loop. The statements in a REPEAT_UNTIL loop are always executed at least once.
The statements in a WHILE_DO loop might never be executed.
pos := -1;
REPEAT
pos := pos + 2;
UNTIL ((pos = 101) OR (structarray[pos].value = targetvalue))
end_repeat;
Example 2
If you want this Enter this structured text
Move ASCII characters from a SINT array into a string tag. (In a SINT array, each
element holds one character.) Stop when you reach the carriage return.
Initialize Element_number to 0.
Count the number of elements in SINT_array (array that contains the ASCII
characters) and store the result in SINT_array_size (DINT tag).
Set String_tag[element_number] = the character at
SINT_array[element_number].
Add 1 to element_number. This lets the controller check the next character in
SINT_array.
Set the Length member of String_tag = element_number. (This records the
number of characters in String_tag so far.)
If element_number = SINT_array_size, then stop. (You are at the end of the
array and it does not contain a carriage return.)
If the character at SINT_array[element_number] = 13 (decimal value of the
carriage return), then stop.
element_number := 0;
SIZE(SINT_array, 0, SINT_array_size);
Repeat
String_tag.DATA[element_number] := SINT_array[element_number];
element_number := element_number + 1;
String_tag.LEN := element_number;
If element_number = SINT_array_size then
exit;
end_if;
Until SINT_array[element_number] = 13
end_repeat;
To make your structured text easier to interpret, add comments to it.
• Comments let you use plain language to describe how your structured text
works.
• Comments do not affect the execution of the structured text.
To add comments to your structured text:
To add a comment Use one of these formats
on a single line //comment
(*comment*)
/*comment*/
at the end of a line of structured text
within a line of structured text (*comment*)
/*comment*/
that spans more than one line (*start of comment. . .end of comment*)
/*start of comment. . .end of comment*/
Structured Text
Components: Comments

Table of Contents

Other manuals for Allen-Bradley Studio 5000 Logix Emulate

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Allen-Bradley Studio 5000 Logix Emulate and is the answer not in the manual?

Allen-Bradley Studio 5000 Logix Emulate Specifications

General IconGeneral
BrandAllen-Bradley
ModelStudio 5000 Logix Emulate
CategoryController
LanguageEnglish

Related product manuals