<8. Detailed Description>
137
TI 34P02K35-02E Jun. 6, 2018-00
8.3 Precautions about Multi-tasking
The section describes some precautions when creating a control application with
multiple tasks.
1. Device Label Definition
When defining a device label, in addition to signal type and data range, specify a
task for updating the data of the device label.
For a multi-tasking control application, specify a task that uses the device label for
updating its data. If a task not using a device label is specified for updating its data,
this may sometimes affect control adversely.
The figure below shows an example of system operation with Task A specified for
updating analog input (AI001) and analog output (A001).
When Task A runs, input processing is first performed and the value of AI001 is read.
Next, this value is used in control calculation processing and the output value at
AO001 is determined.
After control calculation is completed, output processing is performed and the
written value is output at AO001.
AI001
AO001
AI001
AO001
Scan cycle 1
Input
proces-
sing
Control/
calculation
processing
Output
proces-
sing
Input
proces-
sing
Control/
calculation
processing
Output
proces-
sing
Scan cycle 2
Task A
Next, let’s consider a multi-tasking scenario where Task A and Task B have different
execution intervals and Task B is incorrectly specified for updating device labels
AI001 and AO001, which are used by Task A.
In the figure shown below, the value of AI001 is updated by Task B’s input
processing.
In Task A’s control cycle 1, the updated value is used for control calculation and the
output result is written to AO001.
However, as the output of AO001 is done by Task B’s output processing, the written
output value is not output yet.
Next, Task A’s scan cycle 2 is executed.
At this time, as Task B is still executing its control calculation, the value of AI001 is
not updated. In other words, although the actual value has changed, control
calculation is performed using the same value used in scan cycle 1.
Moreover, the output result of scan cycle 2 is written to AO001, overwriting the
output result of scan cycle 1. As AO001 is output by Task B's output processing, the
output result of scan cycle 1 is, in effect, ignored.
Next, Task A’s scan cycle 3 is executed.
Even at this point, the value AI001 is not updated so even though the actual value
has changed, control calculation is done using the same value used in scan cycle 1
and scan cycle 2.
Moreover, even though the output result of scan cycle 3 is written to AO001, it is
overwritten by the output value of a subsequent cycle and thus ignored.
Summary of Contents for STARDOM FCN-500
Page 2: ...Blank Page...
Page 10: ...Blank Page...
Page 32: ...Blank Page...
Page 36: ...TI 34P02K35 02E Jun 6 2018 00 Blank Page...
Page 76: ...TI 34P02K35 02E Jun 6 2018 00 Blank Page...
Page 163: ...Blank Page...
Page 221: ...Blank Page...
Page 225: ...Blank Page...