Eeprom write timer – Echelon Neuron C User Manual

Page 53

Advertising
background image

Neuron C Programmer’s Guide

41

count

A value between 1 and 33,333. See the

Neuron C Reference Guide

for

the formula used in determining the duration of the delay. Values in
the range 33,334 .. 65,535 can be specified, but cause a watchdog

timer reset.

Example:

when (io_changes(io_switch))
{
delay(400); // wait 10msec for debounce
.
.
.
}

The msec_delay( ) function produces a delay of a fixed number of milliseconds
independent of the input clock speed. This function can be used with to delay for

a more precise, and shorter, period of time than the delay( ) and scaled_delay( )

functions. Its prototype is shown below:

void msec_delay (unsigned short

milliseconds

);

milliseconds

A number of milliseconds to delay (max of 255 ms).


The scaled_delay( ) function produces a delay with a duration that scales with

input clock speed. Its syntax is:

void scaled_delay (unsigned long

count

);

count

A value between 1 and 33,333. See the

Neuron C Reference Guide

for

the formula used in determining the duration of the delay.

EEPROM Write Timer

The accuracy of the configurable EEPROM write timer degrades with the speed

of the input clock. To determine the accuracy of an

n

millisecond timeout, use the

formula:

duration =

n

* delay(43)

For example, for a Series 3100 device at 625 kHz, a 20 millisecond EEPROM

write actually takes 55.2 milliseconds.



Advertising