Software
®
26
SIMPL+
PUSH trig
{
j=0;
FOR(j=0 to 32000)
{
q = j;
}
i = q;
}
This program output would only show the final result; the TEST2 would be triggered
once with the value 32000. The system will still perform whatever task switching
required. As with the X-Generation series, re-entrance can still be a problem. When
an event has task switched away, the event may be retriggered and a new copy of the
event will start running. Therefore, SIMPL+ events are considered to be re-entrant.
The amount of times that this could occur is dependent upon the available memory in
the system. In order to prevent the event from running multiple times, refer to the re-
entrant example in the X-Generation task switching section.
The programmer should exercise caution when using looping constructs without
constraints (i.e. while(1) ) or depend upon outside influence. Because each event will
run for the allotted time unless specified otherwise, PROCESSLOGIC calls should
be used to reduce the CPU overhead. Consider the following:
DIGITAL_INPUT diInput1, diInput2;
INTEGER I, LastNumSeconds;
PUSH diInput1
{
WHILE (diInput1)
{
// do something
}
}
main()
{
LastNumSeconds = 0;
WHILE (1)
{
seconds = GetNumSeconds();
IF (seconds <> LastNumSeconds)
{
// do something
}
}
}
At the loop in MAIN, the programmer wants to perform an operation every second.
This code will achieve that goal. However, a side effect of the code is that every time
the task is scheduled to run, it will sit in a very tight loop checking for a change in the
Crestron SIMPL+
Language Reference Guide - DOC. 5797G
®
Need help?
Do you have a question about the SIMPL+ and is the answer not in the manual?