Crestron SIMPL+ Especificações Página 32

  • Descarregar
  • Adicionar aos meus manuais
  • Imprimir
  • Página
    / 60
  • Índice
  • MARCADORES
  • Avaliado. / 5. Com base em avaliações de clientes
Vista de página 31
Software Crestron SIMPL+
To see an example of the for loop use the situation alluded to above. That is, a need
to clear each string element in a string array. A program to accomplish this might
look like the following.
DIGITAL_INPUT clearArray; // a trigger signal
INTEGER i; // the index variable
STRING stringArray[50][14]; // a 15-element array
PUSH clearArray // event function
{
for (i = 0 to 14)
{
stringArray[i] = ""; // set the ith element
// to an empty string
print("cleared element %d\n",i); // debug message
} // this ends the for
// loop
} // this ends the push
// function
In this example, the loop index i is set to run from 0 to 14, which represents the first
and last elements in stringArray respectively. Also notice that the step keyword is
omitted. This keyword is optional and if it is not used, the loop index increments by
1 each time through the loop. To clear only the even-numbered array elements, the
following could have used.
for (i = 0 to 14 step 2)
{ . . . }
The step value can also be negative, allowing the loop index to be reduced by some
value each time though the loop.
The for loop flexibility can be enhanced further by using expressions instead of
constant values for the start, end, and step values. For example, there might be a need
to add up the value of each byte in a string in order to calculate the value of a
checksum character. Since the length of the string can change as the program runs,
the number of iterations through the loop is unknown. The following code uses the
built-in function, len, to determine the length of the string and only run through the
for loop the necessary number of times. System functions are described in detail in
“Using System Functions” on page 30.
checksum = 0; // initialize the chucksum variable
/* iterate through the string and add up the bytes.
Note that the { } braces are not needed here
because the contents of the for-loop is only
a single line of code */
for (i = 1 to len(someString))
checksum = checksum + byte(someString,i);
/* now add the checksum byte on to the string
using the chr function. Note that in this
example we only use the low-order byte from
the checksum variable */
someString = someString + chr(checksum);
28 • SIMPL+
Programming Guide – DOC. 5789A
Vista de página 31
1 2 ... 27 28 29 30 31 32 33 34 35 36 37 ... 59 60

Comentários a estes Manuais

Sem comentários

ShoreLand'r CRR10TM V.1 Handbücher

Bedienungsanleitungen und Benutzerhandbücher für Anhänger ShoreLand'r CRR10TM V.1.
Wir stellen 1 PDF-Handbücher ShoreLand'r CRR10TM V.1 zum kostenlosen herunterladen nach Dokumenttypen zur Verfügung Bedienungsanleitung






Weitere Produkte und Handbücher für Anhänger ShoreLand'r

Modelle Dokumententyp
CRR10TM V.2 Bedienungsanleitung   ShoreLand'r CRR10TM V.2 User Manual, 6 Seiten
CRR14TM V.1 Bedienungsanleitung   ShoreLand'r CRR14TM V.1 User Manual, 6 Seiten
CRR14TS V.2 Bedienungsanleitung   ShoreLand'r CRR14TS V.2 User Manual, 6 Seiten
CRR14TM V.2 Bedienungsanleitung   ShoreLand'r CRR14TM V.2 User Manual, 6 Seiten
CRR14TS V.1 Bedienungsanleitung   ShoreLand'r CRR14TS V.1 User Manual, 6 Seiten
CRR15AL Bedienungsanleitung   ShoreLand'r CRR15AL User Manual, 9 Seiten
CRR18XLN V.2 Bedienungsanleitung   ShoreLand'r CRR18XLN V.2 User Manual, 10 Seiten
CRR15AS Bedienungsanleitung   ShoreLand'r CRR15AS User Manual, 9 Seiten
CRR22L Bedienungsanleitung   ShoreLand'r CRR22L User Manual, 8 Seiten
CRR18XLN V.1 Bedienungsanleitung   ShoreLand'r CRR18XLN V.1 User Manual, 10 Seiten
CRR22LTMH Bedienungsanleitung   ShoreLand'r CRR22LTMH User Manual, 8 Seiten
CRR22LTSH Bedienungsanleitung   ShoreLand'r CRR22LTSH User Manual, 8 Seiten
CRV15AL Bedienungsanleitung   ShoreLand'r CRV15AL User Manual, 7 Seiten
CRV15AS Bedienungsanleitung   ShoreLand'r CRV15AS User Manual, 7 Seiten
CRV30BLW Bedienungsanleitung   ShoreLand'r CRV30BLW User Manual, 10 Seiten
CRV30BLWTMH Bedienungsanleitung   ShoreLand'r CRV30BLWTMH User Manual, 10 Seiten
CRV30BLWTLH Bedienungsanleitung   ShoreLand'r CRV30BLWTLH User Manual, 10 Seiten
CRV30BLWTSH Bedienungsanleitung   ShoreLand'r CRV30BLWTSH User Manual, 10 Seiten
CRV46TBL V.1 Bedienungsanleitung   ShoreLand'r CRV46TBL V.1 User Manual, 12 Seiten
CRXR2314L V.2 Bedienungsanleitung   ShoreLand'r CRXR2314L V.2 User Manual, 10 Seiten