Allen-Bradley Logix5000 Reference Manual page 692

1756 controllogix, 1768 compactlogix, 1769 compactlogix, 1789 softlogix, 1794 flexlogix, powerflex 700s with drivelogix
Hide thumbs Also See for Logix5000:
Table of Contents

Advertisement

Appendix C
Structured Text Programming
If you want this
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.
1. Initialize Element_number to 0.
2. Count the number of elements in SINT_array (array that contains
the ASCII characters) and store the result in SINT_array_size
(DINT tag).
3. If the character at SINT_array[element_number] = 13 (decimal
value of the carriage return), then stop.
4. Set String_tag[element_number] = the character at
SINT_array[element_number].
5. Add 1 to element_number. This lets the controller check the next
character in SINT_array.
6. Set the Length member of String_tag = element_number. (This
records the number of characters in String_tag so far.)
7. If element_number = SINT_array_size, then stop. (You are at the
end of the array and it does not contain a carriage return.)
8. Go to
step
3.
692
Example 2:
Rockwell Automation Publication 1756-RM003N-EN-P - October 2011
Enter this structured text
element_number := 0;
SIZE(SINT_array, 0, SINT_array_size);
While SINT_array[element_number] <> 13 do
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;
end_while;

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents