EasyManua.ls Logo

Crestron SIMPL+ - Function Main

Crestron SIMPL+
60 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
Software Crestron SIMPL+
CHANGE output_value
PUSH button1, button2
{
<statements>
}
A useful feature of SIMPL+ event functions is that a single input can have more than
one event function defined for it. This makes it possible to write one event function
for a specific input only and another event function for a group of inputs. Refer to the
following example.
PUSH button1
{ // code here only runs when
// button1 goes high
}
PUSH button1, button2, button3
{ // this code runs when any of
// these inputs goes high
}
The Global Event
A special form of event exists, which is triggered anytime any of the inputs to the
SIMPL+ module changes. This is simply a shortcut for having to build a compound
event manually which includes all the inputs separated by commas in a CHANGE
event declaration. Access this special event function by using the EVENT keyword,
as follows.
EVENT
{ // this code runs anytime anything
// on the input list changes
}
Be careful when using this global event function. If the user has a SIMPL+ program
in which a change on any input causes the same code to execute, this type of event is
useful. However, if additional inputs are added at a later time, remember that this
event function exists, and is caused when these new inputs change as well. This may
not be desirable.
Function Main
Main is a special case of a user-defined function. The Main function is executed
when the control system initializes (boots up) and is never called again. In many
cases, the main function is used to initialize variables; it may not contain any
statements at all.
However, in some cases, a loop may be placed in the Main function to perform a
continuous action. Refer to the following example, and note that this example uses a
while loop construct, which is discussed in “Controlling Program Flow: Loops” on
page 27.
Function Main()
{
x = 0; // this code executes only once
12 SIMPL+
Programming Guide – DOC. 5789A

Other manuals for Crestron SIMPL+

Related product manuals