SETOCCUPATIONTIME
(Statement)
[RC7 Version 2.0 or later]
Reconfigures the processing time to be exclusively occupied by supervisory tasks.
SETOCCUPATIONTIME <ProcessingTime>
When the supervisory task mode is enabled, SETOCCUPATIONTIME reconfigures the processing time to be exclusively occupied by supervisory tasks to <Processing time>.
<Processing time> 0, 2, 4, 6 or 8
0: 0 ms/8 ms
2: 2 ms/8 ms
4: 4 ms/8 ms
6: 6 ms/8 ms
8: 8 ms/8 ms
This statement can be placed in the execution of supervisory tasks. It immediately takes effect. If it is disabled, this statement produces nothing.
If you select "0 ms," supervisory tasks will be processed only when no user tasks are being processed. If there is no free time, no supervisory tasks will be able to be processed.
If you select "8 ms," no user tasks can be processed when any supervisory task is being processed. To process user tasks, you need to insert a process of DELAY or WAIT for getting an arm semaphore in the supervisory tasks.
The following coding example contains three programs--supervisory task TSR1 and user programs PRO1 and PRO2. In ordinary operations, PRO1 and PRO2 are given higher priority during 6 ms, but in robot motions TSR1 is given higher priority during 4 ms even it sacrifices execution of PRO2 to some degree.
PROGRAM TSR1
|
'Supervisory task TSR1 checks the robot motion range.
|
-----------
|
|
-----------
|
|
END
|
|
|
|
PROGRAM PRO1
|
|
TAKEARM
|
|
-----------
|
|
SETOCCUPATIONTIME 4
|
'Set 4 ms for supervisory tasks.
|
MOVE P,P0
|
'Move the robot.
|
SETOCCUPATIONTIME 2
|
'Restore the processing time to be
'occupied by supervisory tasks to the
'default (2 ms).
|
-----------
|
|
END
|
|
PROGRAM PRO2
|
|
DO WHILE 1
|
|
-----------
|
|
LOOP
|
|
END
|
|