NetLinx Programming Overview
19
NetLinx Programming Language Reference Guide
Parameters:
The number of loop executions is usually stated at the beginning of the loop, unlike
WHILE
and
LONG_WHILE
loops.
In Axcess, a typical loop may look something like this:
COUNT = 0
WHILE (COUNT<10)
{
COUNT = COUNT + 1
(* loop statements *)
}
In NetLinx you can write the same loop with a
FOR
statement and clarify how the loop operates:
FOR (COUNT=0 ; COUNT<10 ; COUNT++)
{
(* loop statements *)
}
By defining the loop like this, you clearly see how it is initialized and incremented. No errors appear if
you forget to initialize the
WHILE
loop or counter. The
FOR
loop helps to insure proper structure.
Functions
Axcess only supports one method to create subroutines:
DEFINE_CALL
. The
DEFINE_CALL
does not
return values very eloquently. If you pass a variable to a parameter of the
DEFINE_CALL
and then
change the parameter value within the subroutine, the program updates the value of the global variable in
the mainline code.
NetLinx has two methods for creating subroutines:
DEFINE_CALL
and
DEFINE_FUNCTION
.
DEFINE_CALL
DEFINE_CALL
is intended to run segments of code that are repeated throughout the program, but don't
require a return value. For example, this
DEFINE_CALL
creates a macro to lower a screen, turn on the
projector, and set the lights to Preset 1. The subroutine executes three commands and no values are
returned to the program.
DEFINE_CALL 'PRESENTATION MACRO'
{
SYSTEM_CALL [1] 'SCREEN1' (0, 0, 1, 0, SCREEN, 1, 2, 3, 0)
SEND_STRING VPROJ, "'PON',$0D,$0A"
SEND_STRING RADIA, "'1B',$0D"
}
<INITIAL>
Contains one or more statements that are executed one time before any
FOR
loop statements are executed; each statement must be separated by a
comma (
,
).
<condition>
The condition for which the loop is evaluated before each pass. If the condi-
tion evaluates
TRUE
, the
FOR
loop statements execute. If the condition eval-
uates
FALSE
, the loop terminates.
<after pass>
Contains one or more statements that are executed after each pass through
the loop statements; each statement is separated by a comma (
,
). This is
typically a statement that increments the FOR-loop index.
Содержание NETLINX PROGRAMMING LANGUAGE
Страница 15: ...Table of Contents xiii NetLinx Programming Language Reference Guide...
Страница 16: ...xiv NetLinx Programming Language Reference Guide Table of Contents...
Страница 18: ...Introduction 2 NetLinx Programming Language Reference Guide...
Страница 76: ...Language Elements 60 NetLinx Programming Language Reference Guide...
Страница 106: ...Combining Devices Levels and Channels 90 NetLinx Programming Language Reference Guide...
Страница 112: ...Master To Master M2M 96 NetLinx Programming Language Reference Guide...
Страница 114: ...Mainline 98 NetLinx Programming Language Reference Guide FIG 1 Message and Mainline Processing in the NetLinx System...
Страница 182: ...Reserved Identifiers 166 NetLinx Programming Language Reference Guide...
Страница 204: ...NetLinx UniCode Functions 188 NetLinx Programming Language Reference Guide...
Страница 244: ...Appendix B Glossary 228 NetLinx Programming Language Reference Guide...
Страница 245: ...Appendix B Glossary 229 NetLinx Programming Language Reference Guide...