
B–61863E–1/06
5. TUTORIAL
GENERAL
25
This section describes about the task for cyclic execution and how to
create tool life counter application by cyclic task.
The files are in the directory \tutorial\5–5.
(1) File confirmation.Please use the files (ctl.c and tutorial.bld) in the
directories as listed below.
The files in \tutorial\5–5\rc for PMC–SC/SC3/SC4.
The files in \tutorial\5–5\nb for PMC–NB/NB2.
D ctl.c Link control statement
D task1.c Source code
D task1.con Command file for binder
D tutorial.bld Build file
D tutorial.con Command file for binder
D tutorial.h Header file
(2) Modification
The difference from chapter 5.4.3 is described below.
D task1.c
The PMCMDI wait function pl_pcmdi_wait() was replaced by
os_wait_tim().
Please refer to the source code for details about the tool life
counter (code is omitted in this example).
File task1.c
void far task1(void)
{
long tool_no;
short i;
while(1) {
tool_no = *pl_meml2(D, 0);
:
os_wait_tim(CYCLE);
}
}
← timer wait’s 96ms
Realization of the cyclic task.
Within the endless loop of task1 the continuation of the process
is delayed for 96ms by the function os_wait_tim(CYCLE). After
the execution of os_wait_tim(CYCLE) the while loop restarts.
In case of the following, the execution is not guaranteed.
D When an other cyclic task with higher priority is executing
at the same time.
D When the process time in the cyclic task is too long.
(3) Procedure for execution.
The procedure is the same as explained in chapter 5.4.2. The
necessary operations are described below.
> ic286 task1.c pr(task1.lis) oj(task1.obj) compact extend rom
> ic286 ctl.c pr(ctl.lis) oj(ctl.obj) compact extend rom
> bnd386 &<task1.con
> bnd386 &<tutorial.con
> bld386 tutorial.lnk oj(tutorial.dat) bf(tutorial.bld)
> oh386 tutorial.dat 386 >tutorial.hex
> map386 tutorial.dat notypecheck
Transfer to PMC
Setting LANGUAGE ORIGIN OF SYSPRM
5.5
CYCLIC TASK