5. Initial Programming
222
In this profile, the “MainTask” is cyclic with priority fixed in 13 and executes exclusively the
“MainPrg” program. The “ProtTask” is cyclic as well, but its priority is 1 (one), thus it goes first than
the previous and it executes exclusively the “ProtPrg” program.
“MainTask” and “ProtTask” are already completely defined and the developer must create the
programs “StartPrg”, “UserPrg” and “UserProtPrg” through any of the IEC 61131-3 languages. It is
not always possible to convert a program to another language, but it is always possible to create a
new program with the same name constructed with a different language.
By default, MasterTool Xtorm uses “MasterTool Standard Project” associated to the “Profile for
RTU”. It includes the programs “StartPrg”, “UserPrg” and “UserProtPrg” which were created in the
languages chosen during the project creation and the programs “ProtPrg”, “MainPrg”, “AlarmPrg”
and “EngineeringPrg” which were created in ST (Structured Text).
Task
POU
Priority
Type
Default value
Options
Event
MainTask*
MainPrg
13
Cyclic
20 ms
5 to 100 ms
-
ProtTask
ProtPrg
1
Cyclic
4 ms
4 to 20 ms
-
Table 5-3. Task in Profile for RTU
Custom Profile
The Custom project profile allows the developer to exploit all Runtime System potentialities,
implemented in the Hadron Xtorm Series processing centrals. None of the functionalities is disabled;
neither any priority nor association between task and programs is imposed. It is also possible to
create tasks and programs with any names, except for “MainTask”, “StartPrg”, “MainPrg”,
“AlarmPrg” and “EngineeringPrg”, which must keep their names. “MainPrg”, “AlarmPrg” and
“EngineeringPrg” cannot be edited.
Besides the real time tasks with 00 to 15 priorities, which are scaled by priority, this profile also
allows the tasks definition with smaller priorities smaller from 16 to 31.
Within “Custom”, the user can generate some tasks that are not present in “Profile for RTU” -
“CyclicTask00” and “CyclicTask01”. These two tasks run “CyclicPrg <nn>” and “CyclicTask <nn>”
programs respectively. Both types form a group called Basic Tasks.
This profile may further include interruption tasks with higher priority than the basic tasks and
therefore can interrupt (preempt) the execution of those at any time.
The ideal is to keep the average execution time of tasks in 50% of watchdog time (maximum). Thus,
the chances of watchdog occurrence for any errors peaks are lower. This parameter is only editable in
the custom profile.
The system also presents the so-called “ExternInterruptTask <nn>”. These are interruption tasks of
the External type (“Extern”) whose execution is triggered by some external event, such as changes in
a control signal on a serial port. These tasks run the “ExternInterruptPrg <nn>” programs. The tasks
called “TimeinterruptTask <nn>” are interruption tasks of “cyclic” type and run the
“TimeInterruptPrg <nn>” program.
In this project profile, the application can still include the “FreeTask” (“Freewheeling”), which runs
the “FreePrg” program. This is a low priority task that can be interrupted by all the others and that is
able to run blocked codes.
The “Custom Profile” provides eight tasks with POUs fully defined and their associated programs
already created in the selected language. The user can configure intervals, trigger events and
priorities of any task.