Crestron simpl plus language ref 사용자 설명서

다운로드
페이지 374
Software Crestron 
SIMPL+
®
22 
z SIMPL+
®
Language Reference Guide - DOC. 5797G
Task Switching
Task Switching for X-Generation (CNX) Control Systems
Each SIMPL+ module runs as a separate task in the X-Generation (CEN-TVAV, 
CNMSX-AV/PRO, CNRACKX/-DP) Control System. In order to insure that no 
SIMPL+ program takes up 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.
The system will not arbitrarily switch out at any point in time. Even if the task limit 
is exceeded, the system will force a task switch only at predetermined points.
The system will perform a task switch when a PROCESSLOGIC, DELAY, or 
PULSE function is encountered. When a task switch is performed, the output I/O 
definitions are updated (refer to ANALOG_OUTPUT, DIGITAL_OUTPUT, 
STRING_OUTPUT for further information). Note that a WAIT does not cause a task 
switch. 
When a WHILE, DO-UNTIL, or FOR construct encounters its last statement, or any 
construct that causes a “backwards branch”, the system checks to see if a timeout has 
occurred. If the timeout has occurred, then the system will task switch away. When 
the module is given time to run, it will resume at the top of the construct. 
For this reason, a designer of a SIMPL+ module should take care to design with this 
in mind. A particular concern is if the outputs need to be updated in a specific fashion 
and have a loop, which may potentially cause the system to switch away. One 
solution would be to store the output variables in intermediate arrays or variables, and 
assign the intermediate variables to the output variables before the event terminates.
Example:
    DIGITAL_INPUT trig;
    ANALOG_OUTPUT i;
    INTEGER j;
    PUSH trig
    {
      j=0;
      FOR(j=0 to 32000) 
      {
        i = j;
      }
    }