Priority when clauses, 23). series 50 – Echelon Neuron C User Manual

Page 35

Advertising
background image

Neuron C Programmer’s Guide

23

Letter names shown above are used for the clauses in Figure 1 and the following

narration of events. This shows how the order of execution of tasks differs from
the order the when clauses appear in a program.
At the start of this example, no event has occurred, thus no when clause event

expression is TRUE.

1

The scheduler begins with A. Since A is FALSE, its task is not executed.

2

Event C occurs and the expression C becomes TRUE.

3

The scheduler moves to B. Since B is FALSE, its task is not executed.

4

The scheduler moves to C. Since C is TRUE (item 2, above), its task is

executed.

5

A becomes TRUE.

6

The scheduler moves to D. Since D is FALSE, its task is ignored.

7

The scheduler moves back to A. Since A is TRUE (item 5, above), its task
is executed.

Figure 1. Example Scheduler Timeline

Priority When Clauses

The priority

keyword can be used to designate when clauses that should be

evaluated more often than nonpriority when clauses. Priority

when clauses are

evaluated in the order specified

every

time the scheduler runs. If any priority

when clause evaluates to TRUE, the corresponding task is executed and the

scheduler starts over at the top of the priority

when clauses.

If none of the priority when clauses evaluates to TRUE, then a nonpriority when
clause is evaluated, selected in the round-robin fashion described earlier. If the

selected nonpriority when clause evaluates to TRUE, its task is executed. The

scheduler then resumes with the first priority when

clause. If the nonpriority

Advertising