Crestron simpl plus language ref 사용자 설명서

다운로드
페이지 374
Crestron SIMPL+
®
Software 
Language Reference Guide - DOC. 5797G
 SIMPL+
®
 
z 25
Task Switching for 2-Series Control Systems
In the 2-Series Control Systems, each SIMPL+ module also runs as one or more 
concurrent tasks in the control system. The MAIN and each event handler run as 
separate tasks sharing a common global data space. 
To insure that no SIMPL+ program takes too much time, each task is allotted a certain 
amount of time to run. If the task exceeds this time limit, the system will switch out 
and allow other tasks (including the SIMPL program) to run. It should also be noted 
that the task would run until it has completed the operation, the allotted time expires 
or a task switching call is executed.
Unlike the X-Generation systems, the system will arbitrarily switch out at any point 
in time. If this may result in undesirable behavior, then the programmer should 
control his task switching by issuing a PROCESSLOGIC function.
The system will perform a task switch when a PROCESSLOGIC or DELAY function 
is encountered. The PULSE will no longer cause a task switch because it is no longer 
needed for the logic processor to process the digital output pulse. Note that a WAIT 
does not cause a task switch but will execute in its own task. 
All outputs are processed by the logic processor as soon as assigned. As soon as the 
SIMPL+ module releases the processor, all the outputs are seen by the logic 
processor. Also, the programmer can read back DIGITAL_OUTPUTS and 
ANALOG_OUTPUTS without having to insert a PROCESSLOGIC in between.
To use the example from the Task Switching for X-Generation Control System 
discussion:
    DIGITAL_INPUT trig;
    ANALOG_OUTPUT i;
    ANALOG_OUTPUT NewNumber;
    INTEGER j;
    PUSH trig
    {
      j=0;
      NewNumber = 1234;
      j = NewNumber; //j = 1234, not old value of NewNumber
      FOR(j=0 to 32000) 
      {
        i = j;
      }
    }
A SIMPL program drives the trig signal and monitors the state of 
ANALOG_OUTPUT with an ANALOG DEBUGGER (Speedkey: TEST2) symbol. 
The TEST2 output would show all numbers from 0 to 32000. If it were critical that 
the ANALOG_OUTPUT were only updated with the final value, the following 
alternative solution could be used:
    DIGITAL_INPUT trig;
    ANALOG_OUTPUT i;
    INTEGER j, q;