Fanuc C-Executer Operating Manual
B-62443EN-3/03E
- 891 -
Auxiliary tasks are executed by interrupting the main task.
Task switching from the auxiliary task to the task of lower priority is
accomplished by calling functions which wait for certain events to happen.
There are following functions which are used for this purpose.
Event Function
-----------------------+------------------------------
Time os_sync_tim(), os_wait_tim()
Event flag os_wait_flg()
Semaphore os_wait_sem()
Status of serial port rs_wait()
This type of task management is called "event driven" task management.
+-------------------+ +-----
auxiliary task ----+ (run) +- (wait for event)-+
+------------------+
main task - - - - - (wait) - - - - -+ (run) + - -
^ ^
system start Event happens
5.1.1.4 Data access between tasks
Each task has its own memory spaces independent of each other. That is, the
address 0 of the alarm task and the address 0 of the main task, for example,
are located at different physical memory locations. Generally, variables or
functions are located in the task specific memory space. Consequently, tasks
cannot access variables of other tasks nor call functions defined by other
tasks.
To exchange data between tasks, the inter-task common variable is to be used.
The variables defined in the special source files, dramver.c and sramver.c, are
located in the inter-task common memory as the common variables.
When defining the common variables in the files, dramver.c or sramver.c,
specify the attribute "volatile" for the variables in the definition statement.