Scaled timers and i/o objects, Calculating accuracy for software timers, Accuracy of millisecond timers – Echelon Neuron C User Manual

Page 49: With a 10 mhz input clock

Advertising
background image

Neuron C Programmer’s Guide

37

• Triac pulse timer. Timer used to generate pulses for the stretchedtriac

and triac output objects.

The following timers are implemented in software and have periods that are

independent of the Neuron Chip or Smart Transceiver input clock. The accuracy
of these timers is discussed in the next section.

• Application second timer (that is, an stimer declared in a Neuron C

program).

• Application millisecond timer (that is, an mtimer declared in a Neuron C

program).

Scaled Timers and I/O Objects

Timers and I/O objects that scale with the input clock are directly proportional to

the input clock. For example, a serial object configured at 2400 bps would

actually run at 600 bps given a 2.5 MHz (1/4 speed) input clock. The following
timers scale with the input clock:

• bitshift clock
• neurowire master clock
• serial clock
• watchdog timer (only scales for Series 3100 devices)

Note: The configurable EEPROM write timer accuracy is affected by the input
clock. See

EEPROM Write Timer

on page 41 for more information.

Calculating Accuracy for Software Timers

This section describes the accuracy of the millisecond and second timers for

various system clock rates.

Accuracy of Millisecond Timers

The following formulas define the range of accuracy for a millisecond timer.

Accuracy is expressed as a low and high duration. The low duration

(L)

is the

minimum time from when a timer is set to when the system posts an event for
the application. The high duration

(H)

is the maximum time from when a timer

is set to when an event is posted.

L

and

H

are expressed below as a function of

E

,

the expected duration.

The added delay to detect the expiration event, that is, the

latency

, is a function

of the application and is

not

included in these formulas. For example, an event

posted while the application is executing a task associated with a when clause is

be detected until the executing task completes and returns control of the

application to the scheduler.

Note

:

When an event is posted by the Neuron firmware, it becomes visible to the

scheduler and to other events (for example, io_changes, nv_update_occurs).

With a 10 MHz Input Clock

In the following formula, the

floor( )

function returns the largest integer not

greater than the argument, for example,

floor(

3.3) = 3 or

floor

(3.0) = 3. For a

Advertising