Arrays and Strings
34
Axcess Programming Language
Assuming that SCREEN_UP is a constant with the value of 1, and X with the value of 10, the string
expression is evaluated as a string with values: 1, 5, Ø, 'N', 'O', 1Ø, as shown in FIG. 10. Since the
expression is evaluated at run time, whatever value is in the variable X when the expression is
evaluated is what is placed into the result.
Arrays as Strings
There are two ways of referencing array data in Axcess programs. Each location can be referenced
as an individual value; or, each array can be referenced as a group of values. An entire array can be
accessed as one unit. If you refer to an array without specifying an index value, the contents of the
entire array is referenced as a string, as shown in the following example:
DEFINE_VARIABLE
S1[1Ø]
DEFINE_PROGRAM
S1='TEST ONE'
SEND_STRING CARD,'TEST TWO'
SEND_STRING CARD,"S1"
This small section of code will send two strings to the card named CARD: first 'TEST TWO', then
'TEST ONE'. We assigned a string expression to S1 and then sent it to the card; the entire contents
of the string expression was sent.
Suppose that during power-up of the Axcess Control System you want to set all the presets to
default values. You could do this by assigning values to each individual location in the
CAM_PRESETS array. It is recommended, however, to use a string expression to set all six at once,
as shown below:
DEFINE_START
CAM_PRESETS = "Ø,3Ø,9Ø,128,191,255" (* set all preset values at power-up *)
String Lengths
Every array declared in the DEFINE_VARIABLE section has a string length value associated with
it. The string length of an array is an internal value set for arrays by string assignment operations.
This number is different than the storage capacity declared in the DEFINE_VARIABLE section.
You can get the length value of an array by using the LENGTH_STRING function. For example:
LENGTH = LENGTH_STRING (CAM_PRESETS)
Here are examples of some assignments, and what the above line of code would return to the
variable length in each case:
A string expression cannot contain another string expression; i.e., a set of double quotes cannot
enclose another set of double quotes.
FIG. 10
A string expression is assigned to the array TEMP.
Содержание Axcess
Страница 1: ...instruction manual Software Axcess Programming Language ...
Страница 8: ...vi Axcess Programming Language Table of Contents ...
Страница 12: ...Introduction 4 Axcess Programming Language ...
Страница 22: ...Axcess Basics 14 Axcess Programming Language ...
Страница 38: ...Channel Characteristics 30 Axcess Programming Language ...
Страница 54: ...Levels 46 Axcess Programming Language ...
Страница 62: ...Operators 54 Axcess Programming Language ...
Страница 66: ...Variable Types and Conversions 58 Axcess Programming Language ...
Страница 70: ...Two Dimensional Arrays 62 Axcess Programming Language ...
Страница 80: ...While Keywords 72 Axcess Programming Language ...
Страница 86: ...Using Buffers 78 Axcess Programming Language ...
Страница 94: ...Waits and Timer Keywords 86 Axcess Programming Language ...
Страница 102: ...Using Subroutines 94 Axcess Programming Language ...
Страница 108: ...Include Files and System_Calls 100 Axcess Programming Language ...
Страница 120: ...Compiler Error Messages 112 Axcess Programming Language ...
Страница 124: ...The External_Control Protocol 116 Axcess Programming Language ...
Страница 143: ...Index 135 Axcess Programming Language ...