EasyManua.ls Logo

Allen-Bradley LOGIX 5000

Allen-Bradley LOGIX 5000
561 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
Loading...
Structured Text Programming
Chapter 10
Rockwell Automation Publication 1756-RM006K-EN-P - November 2018 533
Example 2
If performing the following, 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;
Use the WHILE_DO loop to continue performing an action while certain
conditions are true.
Operands
WHILE bool_expression DO
<statement>;
Structured Text
Operand Type Format Description
bool_expression BOOL tag
expression
BOOL tag or expression that
evaluates to a BOOL value
WHILE_DO

Table of Contents

Other manuals for Allen-Bradley LOGIX 5000

Related product manuals