Online event, Syntax, Example – Echelon Neuron C User Manual

Page 36: Reset event

Advertising
background image

16

Predefined Events

online

Event

The online event evaluates to TRUE only if the device is offline and an

Online

network management message is received from a network tool. The online event
can be used in no more than one

when

clause in a program. The task associated

with the online event in a when clause can be used to bring a device back into

operation in a well-defined state.

Syntax

online

Example

when (offline)
{
flush_wait();
// process shut-down command
}

when (online)
{
// resume operation
}

reset

Event

The reset event evaluates to TRUE the first time this event is evaluated after a

Neuron Chip or Smart Transceiver is reset. I/O object and global variable
initializations are performed before processing any events. The reset event task

is always the first when clause executed after reset of the Neuron Chip or Smart

Transceiver. The reset event can be used in no more than one when

clause in a

program.
A typical application’s reset task initializes peripheral I/O circuitry, prepares the
APIs for utilities and libraries, and initializes application timers and the

interrupt system. See also

Initial Value Updates for Input Network Variables

in

Chapter 3 of the

Neuron C Programmer’s Guide

.

The code in a reset task is limited in size. If you need more code than the

compiler permits, move some or all of the code within the reset task to a function

called from the reset task. The execution time for the code in a reset task must
be less than 18 seconds to prevent installation errors due to time-outs in network

tools. If your device requires more than 18 seconds for reset processing, use a

separate and independent task to complete the reset processing. For example,
you can set a global variable within a reset task that is tested within another

when clause to create this independent task.
The power_up( ) function can be called in a reset clause to determine whether the
reset was due to power-up, or to some other cause such as a hardware reset,

software reset, or watchdog timer reset.

Advertising