![Crestron SIMPL+ Скачать руководство пользователя страница 18](http://html1.mh-extra.com/html/crestron/simpl/simpl_programming-manual_2684744018.webp)
Software
Crestron
SIMPL+
Analog Inputs/Outputs
Analog signals are used in SIMPL to accomplish tasks for which digital signals are
inadequate. Typical examples include volume control and camera pan/tilt control. In
SIMPL+, analog signals take on even greater importance since they provide an easy
way of transferring data (16 bits at a time) into and out of SIMPL+ modules.
In SIMPL+, analog signals are treated much as they are in SIMPL. They are 16-bit
numbers that can range between 0 and 65,535 (unsigned) or –32768 and +32,767
(signed). Signed and unsigned numbers are discussed in detail in “Integers” on page
16.
String Inputs/Outputs and Buffer Inputs
Perhaps the greatest advantage that SIMPL+ provides is related to string handling. In
SIMPL, serial data can be generated dynamically and placed on serial signals.
However, one problem that arises is due to the “transient nature” of these signals.
Simply put, serial signals are invalid except for the time between when they are
created and when they reach the next symbol. With careful programming this does
not cause problems, but it requires a good understanding of SIMPL.
SIMPL+ makes working with serial data much simpler by storing this data into
temporary string variables. When a serial signal is connected to a SIMPL+ module
and the SIMPL program causes data to be sent via this signal, the SIMPL+ program
copies the data from this signal into local memory. The data is kept there until the
SIMPL program changes it.
By storing the serial data into a string variable, SIMPL+ programmers can now
perform tasks on strings that were difficult or impossible with SIMPL alone. For
example, it is easy to evaluate a string and then add a checksum byte on the end to
insert or remove characters from a string, or to parse information out of a string for
use elsewhere. Functions that are designed to work explicitly with string signals and
string variables are discussed in detail in the latest revision of the SIMPL+ Language
Reference Guide (Doc. 5797).
Serial data is also unique in that unlike digital or analog signals, the data may not
appear at one time, but instead it can “stream in” (e.g., if it comes from a COM port).
This raises an interesting problem, namely, what happens if a command string
coming in from a device is not picked up as one piece, but rather is broken up into
two or more pieces? The problem arises in that a string input is completely replaced
each time new data is detected on the input. To account for this, an alternate type of
serial input type may be used, the buffer input. The buffer input differs from the
string input in that serial data that comes in is appended onto data that already exists
in the buffer, instead of replacing it. This type of behavior is critical for performing
sophisticated string parsing and manipulation when dealing with streaming data.
Refer to “Working with Strings” on page 45 for a detailed discussion of buffer
inputs.
Signal Scope
Signals are global throughout the entire SIMPL program and to any SIMPL+
program to which they are connected. In a SIMPL+ program, the values of digital,
analog, and string inputs are read (their values can be evaluated). However, their
values cannot be changed from within the SIMPL+, thus they are considered read-
only. Buffer inputs can be read from and modified.
Digital and analog output signals in SIMPL+ can be read and modified. String
outputs can be modified, but cannot be read back. To understand this, the user must
realize what is being seen when looking at the contents of an output variable in a
14
•
SIMPL+
Programming Guide – DOC. 5789A