Event processing – Echelon Neuron C User Manual

Page 32

Advertising
background image

20

Focusing on a Single Device

io_changes). These operators are of equal precedence with each other, but they

are mutually exclusive. They are of higher precedence than relational operators
(that is, comparisons), but lower in precedence than shift and arithmetic

operators.
Following are examples of how the io_changes event expression is parsed:

io_changes (

device

) by a + b

as:
io_changes (

device

) by (a + b)

and
io_changes (

device

) by a < b

as:

(io_changes (

device

) by a) < b

As with any other C operators, the implied precedence can be explicitly changed
by parenthesization. Parentheses should

always

be used to improve clarity of the

code if there is any doubt. Use of extra parentheses has no negative effect upon

the compilation or the code generated.

The Neuron C compiler detects the use of predefined event keywords in when

clauses and treats them specially for code optimization purposes. However, when

event keywords are used as sub-expressions within when clauses, event table
optimizations cannot be used. In the examples below, the first case uses the

event table optimization, the second and third do not:

when (timer_expires) { }
when (! timer_expires) { }
if (timer_expires)

Although the io_changes expression (by and to varieties) does not

require

a

constant value, only

constant-valued

io_changes expressions are optimized into

the when clause event table.

Event Processing

Events related to network activity are processed using two separate queues. One

queue serves the following events related to incoming network messages:

nv_update_occurs

msg_arrives
online
offline

wink

The other queue serves the remaining network events pertaining to completion
events and responses:

nv_update_completes
nv_update_succeeds

nv_update_fails
msg_completes

Advertising