Ensuring Concurrency Of Variable Values Between Tasks - Omron NJ-series User Manual

Machine automation controller cpu unit software
Hide thumbs Also See for NJ-series:
Table of Contents

Advertisement

5-2-13 Ensuring Concurrency of Variable Values between Tasks

If more than one task reads or writes the same global variable, you can use either of the following
two methods to ensure the concurrency of the value of the global variable between the tasks.
Method 1: Write the global variable from only one task and read the variable from the other tasks.
Method 2: With this method, you can write the global variable from more than one task. Use the task
Method 1: Settings for Exclusive Control of Variables in Tasks
 Introduction
You can specify the task that refreshes a global variable and the tasks that access the global vari-
able. This ensures the concurrency of the value of the global variable from the point of view of the
tasks that access the variable.
A single task is set to read and write the value of a specified global variable. That task is called the
refreshing task. Tasks that only read the value of the global variable are also specified. These tasks
are called accessing tasks. This ensures the concurrency of the value of the global variable.
Refreshing
task: Task A
 Application Example
The refreshing task specification is used to ensure the concurrency of the value of a global variable
within a periodic task when the variable is written in the primary periodic task.
Refreshing task
Program
External variable GVar1
NJ-series CPU Unit Software User's Manual (W501)
Use the settings for exclusive control of variables in tasks.
exclusive control instructions.
Read/write
Global variable
Refreshing task is specified.
Refreshing task: Task A
Read/write
Global variable GVar1
Accessing
Read only
task: Task B
Accessing
Read only
task: Task C
Accessing task
Program
Read only
External variable GVar1
The most recent value of the
variable at the end of refreshing
task execution is read at the start
of accessing task execution.
5 Designing Tasks
5-35
5

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents