Variable Types And Conversions; Ascii Codes; Integer Arrays - AMX AXCESS CONTROL SYSTEM PROGRAM Instruction Manual

Programming language
Table of Contents

Advertisement

Variable Types and Conversions

ASCII Codes

A string is broken up into single letters when placed into a string array. Each storage space returns
the letter it is holding when referenced. For the following example, assume that TEMP[3] holds the
letter R. There are actually three ways you can reference this array location, shown in this example
using IF statements:
DEFINE_PROGRAM
IF (TEMP[3] = 'R')
{
SEND_STRING Ø,"'TEMP[3] IS EQUAL TO "R"',$ØD,$ØA"
}
IF (TEMP[3] = $52)
{
SEND_STRING Ø,"'TEMP[3] IS EQUAL TO "R"',$ØD,$ØA"
}
IF (TEMP[3] = 82)
{
SEND_STRING Ø,"'TEMP[3] IS EQUAL TO "R"',$ØD,$ØA"
}
The letter R has an ASCII value of 82 decimal, which is equivalent to 52 in hexadecimal. In
Axcess, hexadecimal numbers begin with a dollar sign ($). Therefore, the 2nd IF statement above
shows $52, a hexadecimal number.
All three methods (letters, decimal ASCII codes, and hexadecimal ASCII codes) can be used
interchangeably. Use whichever method is easiest for the task at hand.

Integer Arrays

All arrays discussed to this point have a range of values in each location of Ø to 255. The range of
values in a single variable is Ø to 65,535, and when a value greater than 255 is assigned to an array
location, the number is truncated above 255. For example, if the number 500 is assigned to a
location in an array, the actual number that is assigned is 244. The easiest way to find the actual
number is to subtract 256 from the number until the number is less than 256 (in this example, 500 -
256 = 244).
To create an array in which each location can contain values greater than 255, use an integer array.
An integer array is just like a normal array, except each location can hold values from Ø to 65,535.
Also, string keywords (i.e. FIND_STRING, REMOVE_STRING, MID_STRING, etc.) do not
work on integer arrays.
To declare an integer array, place the keyword INTEGER in front of the array definition in the
DEFINE_VARIABLE section. If you want your CAM_PRESETS array to be an integer array, you
would include the keyword INTEGER before the array identifier:
DEFINE_VARIABLE
INTEGER CAM_PRESETS[6]
This declares an integer array with six locations; each location can hold values from Ø to 65,535.
Axcess Programming Language
(* CAMERA PRESETS *)
Variable Types and Conversions
55

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Axcess

Table of Contents