Repeating timers – Echelon Neuron C User Manual

Page 51

Advertising
background image

Neuron C Programmer’s Guide

39

treats as 820 microsecond ticks. This means that a timer duration is actually

0.999 times the specified duration.

For example, for a Series 3100 device with a 2.5 MHz clock, a specified timeout of

99 ms would result in an expected duration of 96.67 ms.
The complete formulas for calculating the low and high durations are:

L

=

E

- (11*

S

+ 1)

H = E

+ (11*

S

+ 1)

The high duration with a 2.5 MHz clock and a specified timeout of 99 ms would

thus equal 141.67 ms; the low duration is 51.67.
Note: The number "11" in the formulas above is based on a typical worst case
scenario. In the absolute worst case, that is, the maximum number of timers,

network variables, addresses, and so on, this number can be as high as 32.
In addition, the high duration may be increased by

network management delay

(NMD), an additional skew introduced by network management message

processing. Normally, this term is 0. But, if a device were to process a network

management message, the upper range for any given timeout could be
significantly increased. For example, adding a domain to a device would result in

an NMD of anywhere from 300 ms to (300 + 838*

S

) ms. In general, network

management operations of this type occur infrequently. It is always good
practice to take a device offline, if possible, before sending further network

management messages.

To measure an event’s duration, a timer can be polled before and after the event,

and the difference can be calculated. To measure the duration of events less than

50 milliseconds, use the get_tick_count( ) function instead of the software timers
(see the

Neuron C Reference Guide

).

Repeating Timers

For repeating timers, there is no cumulative drift other than that produced by
the difference in

D

and

E

. The

N

th timeout for repeating timers occurs in the

range of

LR

to

HR

, where:

ER = E * N

and

LR

=

ER

- (11*

S

+ 1)

HR

=

ER

+ (11*

S

+ 1)

For repeating timers, intermediate timeout events are lost if the following is true:

abs

(AR

-

ER

) ≥

E

ER

-

AR

>

E

where

AR

is the actual duration of the repeating timer.

Advertising