Crestron
SIMPL+
Software
while (1)
{
<do something forever>
// code in here runs
//
continuously
}
}
This loop runs continuously for as long as the control system is on. If a construct like
this is used, it is recommended that a
ProcessLogic
or
Delay
function in the loop be
included to allow the logic processor a chance to handle the rest of the system. If one
of these statements is not included, the operating system forces a task switch at some
point in time. These concepts are discussed in detail in “Understanding Processing
Order” on page 49.
Working with Data (Variables)
Programming is really the manipulation of data. Examples of data in a program are
the switcher input and output numbers, the name of the next speaker and the amount
of time left before the system shuts down automatically. This section covers the
different data types available in SIMPL+.
Input/Output Types
Input/output variables are used to transfer data between SIMPL+ modules and the
surrounding SIMPL program. Each input or output variable in the SIMPL+ is
connected directly to a signal in the SIMPL program. SIMPL programmers should
already be familiar with the three signal types available in that language: digital,
analog, and serial. The table below takes a closer look at the type of data conveyed
by these signal types.
SIMPL Signal Types
SIGNAL TYPE
DATA
EXAMPLE
Digital
Single bit
Button push/release
Analog
16-bit (0 to 65,535)
Volume level
Serial
Up to 255 bytes
Serial data input from a COM port
This table illustrates that digital signals only transfer a single bit of information
between SIMPL+ and SIMPL. Of course this makes sense, as digital signals only
have two possible states (on and off). Obviously, analog and serial signals allow the
transfer of much more information per signal. Depending on the application, it may
be more convenient to generate an analog signal in SIMPL and connect it to a
SIMPL+ program, rather than connecting a large number of digital signals and
setting some variable based on which was pressed last (though both methods should
work).
Digital Inputs/Outputs
Digital signals comprise the bulk of signals in a typical SIMPL program. In SIMPL+
they are used mainly to trigger events on the rising- or falling- edge of the signal,
though they can also be used in expressions.
The state (or value) of a digital signal is always either 1 or 0 (also referred to as ON
or OFF). In SIMPL+, assigning a value of 0 to a digital signal turns it OFF.
Assigning it any non-zero value will turn it ON (for clarity, in most cases, use the
value 1).
Programming Guide – DOC. 5789A
SIMPL+
•
13