Crestron
SIMPL+
Software
PUSH startMe
{
Print("I’m starting now...");
Delay(500);
//this equals 5 seconds
Print("and I’m ending 5 seconds later.\n");
}
It is important to realize that the control system never allows a SIMPL+ program to
“lock up” the rest of the system for any significant amount of time. Thus, whenever a
delay function is reached, the control system performs a task switch, meaning that
the execution of the current SIMPL+ module stops momentarily as the natural flow
through the SIMPL program continues. In this case, even though the SIMPL+
program has stopped for five seconds, other code in the overall SIMPL program
(including standard logic symbols and other SIMPL+ modules) continues to operate
normally. The concept of task switching is covered in more detail in the section
marked “Understanding Processing Order” on page 49.
Pulse
The
Pulse
function is used to drive a digital output signal high for a specified amount
of time. Once again, the time is specified in hundredths of seconds. When a
Pulse
statement is executed, the digital output signal specified is driven high and a task
switch occurs. Such a task switch is necessary in order for the rest of the SIMPL
program to recognize that the digital signal has indeed gone high. After the time
specified has expired, the digital output is driven low and another task switch occurs.
The following program causes the digital output signal,
preset_1,
to be pulsed for a
half a second.
#DEFINE_CONSTANT PULSE_TIME 50
DIGITAL_OUTPUT preset_1, preset_2, preset_3;
PUSH some_input
{
Pulse(PULSE_TIME,
preset_1);
}
The
Pulse
function is very similar in operation to the SIMPL One Shot symbol. In
fact, in many cases, it may be more convenient (or more sensible) to simply connect
a One Shot, or Multiple One Shot symbols to the output signals of a SIMPL+
module.
Also notice that unlike the
Delay
function,
Pulse
does not cause a pause in the
execution of the SIMPL+ code. Therefore, the statements that follow the
Pulse
execute immediately and do not wait for the expiration of the pulse time.
Wait Events
Wait
events in SIMPL+ allow operations that are somewhat similar to the
Delay
SIMPL logic symbol. The syntax for a wait event is as follows.
Wait (wait_time [, wait_name])
{
<statements>
}
Programming Guide – DOC. 5789A
SIMPL+
•
43