Reset processing – Echelon Mini EVK User Manual

Page 75

Advertising
background image

with the eeprom storage class don’t get initialized during reset, but only with a

new application image. The following code fragment illustrates this approach:

eeprom boolean FirstStart = TRUE;

when(reset) {

if (FirstStart) {

// do whatever needs doing in this special case

// reset the FirstStart flag:

FirstStart

=

FALSE;

}
}

Reset Processing

When a device is reset while being configured, the application executes the
when(reset)

task. Code in this task typically takes care of initialization of

special application data as well of attached I/O circuitry. Some of these

initialization tasks can take a long time, and may make the device seem

unresponsive. The reset task should not take longer than five seconds, and
cannot take longer than 18 seconds. If more than a few seconds of processing is

required for the reset task, any time-consuming power-up or reset-processing
must be moved into the first when-task that gets executed after the
when(reset)

task has completed. A simple way to accomplish this is by setting

an application-defined flag, as shown in the following code fragment:

// declare the flag:
boolean ResetFlag = TRUE;

when (reset) {

// perform all immediate initialization here

}

when (ResetFlag) {

// perform all delayed reset processing here

..

// signal completion by changing the flag:

ResetFlag = FALSE;

}

Mini EVK User’s Guide

69

Advertising