Language Elements
44
NetLinx Programming Language Reference Guide
A DEVCHAN array is declared in the DEFINE_VARIABLE or DEFINE_CONSTANT section in one of two
ways:
 Declare a DEVCHAN array whose maximum length is determined by the number of elements in
the initialization array on the right-hand side, as shown below:
DEVCHAN[ ] DCSName = {{Dev1,Chan1}, {Dev2,Chan2}, ...}

Use MAXLEN to specify the maximum length of the array, as shown below:
DEVCHAN[ ] DCSName[MAXLEN] = {{Dev1,Chan1}, {Dev2,Chan2}, ...}
In either case, the number of elements in the initialization array determines the effective length of the
array. That value can be determined at run-time by calling
LENGTH_ARRAY. The maximum length
available for a
DEVCHAN[ ] array can be determined by calling MAX_LENGTH_ARRAY.
The individual elements of a
DEVCHAN array can be referenced by their defined names (Dev1, Chan1,
Dev2, Chan2, etc.) or by using array notation with the device-channel array name. For example, the
third element in the device-channel array,
MyDCSet, would be referenced by MyDCSet[3].
Furthermore, since a
DEVCHAN array is an array of DEVCHAN structures, DEVCHAN members can be
referenced using the dot operator notation such as
MyDCSet[3].Device or MyDCSet[1].Channel.
A
DEVCHAN array can be used anywhere a [Device, Channel] specification is required with the
result of providing a range of targets for the command or instruction where it is used. This implies an
alternate form for the following commands:
The index of the last member of the array for which an event notification was received can be determined
by calling
GET_LAST(MyDCSet). This is useful for determining which device and channel in an array
is referenced to in a particular notification message.
Device-level arrays
A device-level array (DEVLEV array) is an array of device-level pairs. Each element is represented
internally as a
DEVLEV structure. This structure combines the fields of a DEV structure representing the
device with a field representing the level number.
STRUCTURE DEVLEV
{
DEV // Device
INTEGER // Level
}
The first component of a device-level pair (Device) represents the device number, port, and system. It
can be specified as either a single device number, a constant
DEV structure or as a D:P:S specification.
Each device specified in a device-level pair should be defined in the
DEFINE_DEVICE section. The
second component is the level number on the device. The level number is expressed as an integer
constant.
A
DEVLEV array is declared in the DEFINE_VARIABLE or DEFINE_CONSTANT section in one of two
ways:
Button[(DEVCHAN)] PULSE[(DEVCHAN)]
DO_PUSH[(DEVCHAN)] PUSH[(DEVCHAN)]
DO_RELEASE[(DEVCHAN)] RELEASE[(DEVCHAN)]
OFF[(DEVCHAN)] TO[(DEVCHAN)]
ON[(DEVCHAN)]