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.

686 Structured Text ProgrammingExample 2:If You Want ThisMove ASCII characters from a SINT array into a string tag. (Ina SINT array, each element holds one character.) Stop whenyou reach the carriage return.1. Initialize Element_number to 0.2. Count the number of elements in SINT_array (array thatcontains the ASCII characters) and store the result inSINT_array_size (DINT tag).3. Set String_tag[element_number] = the character atSINT_array[element_number].4. Add 1 to element_number. This lets the controller checkthe next character in SINT_array.5. Set the Length member of String_tag = element_number.(This records the number of characters in String_tag sofar.)Enter This Structured Textelement_number := 0;SIZE(SINT_array, 0, SINT_array_size);RepeatString_tag.DATA[element_number] :=SINT_array[element_number];element_number := element_number + 1;String_tag.LEN := element_number;If element_number = SINT_array_size thenexit;end_if;Until SINT_array[element_number] = 13end_repeat;6. If element_number = SINT_array_size, then stop. (You areat the end of the array and it does not contain a carriagereturn.)7. If the character at SINT_array[element_number] = 13(decimal value of the carriage return), then stop.Otherwise, go to 3.Publication 1756-RM003I-EN-P - January 2007

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

Saved successfully!

Ooh no, something went wrong!