Crestron SIMPL+ Reference Manual page 37

Language reference guide
Hide thumbs Also See for SIMPL+:
Table of Contents

Advertisement

Crestron SIMPL+
Language Reference Guide - DOC. 5797G
®
number of seconds. Since the allotted time for a SIMPL+ task to run is in fractions of
a second, it is very unlikely to change during the allotted time. Unless the
programmer puts in a DELAY which will put the task to "sleep" for a period of time,
this task will dominate the CPU time.
The programmer who writes the MAIN() function should also be aware that the
MAIN() function begins running when the SIMPL Windows program is initializing.
The module's inputs do not have their programmed state until sometime after the first
break in the program execution due either to a process logic statement or expiration
of a time slice.
The PUSH event indicates a more subtle problem. The programmer wants to loop in
the event until the input diInput1 is released. Once the task containing the event is
started, it will run for its allotted time and no other inputs will change. If the signal
attached to the diInput1 signal goes low, the event will not see to the change until the
event switches out and the diInput1 low signal is processed.
The following is an alternative:
DIGITAL_INPUT diInput1, diInput2;
INTEGER I, LastNumSeconds;
PUSH diInput1
{
WHILE (diInput1)
{
// do something
ProcessLogic();
}
}
MAIN()
{
LastNumSeconds = 0;
WHILE (1)
{
seconds = GetNumSeconds();
IF (seconds <> LastNumSeconds)
{
}
delay(10);
}
}
Here, a 100ms delay is put in the MAIN loop. That means that the task will only wake
up 10-times per second. It will still catch the change of the seconds to within a 1/10
of a second and lessen system requirements.
The PROCESSLOGIC call in the PUSH event handler will immediately cause a task
switch to be performed. This will allow a low transition on the diInput1 signal to be
seen immediately, making the system more responsive.
// do something
Software
®
SIMPL+
27

Advertisement

Table of Contents
loading

Table of Contents