Echelon Mini FX User Manual

Page 106

Advertising
background image

Mini FX User's Guide

93

decide whether to start the ISI engine at reset time, but it does not have to make the

same decision repeatedly. The remainder of the application can make calls into the ISI
API regardless of the ISI engine’s running state. If the ISI engine is not currently

running, the calls into the ISI API are ignored (or yield a benign response).
The ISI engine itself has no knowledge of the application it serves. Some generic services
are provided fully automatically, such as allocation and maintenance of unique device

addresses. However, other services need feedback from the application. For example,
when establishing network variable connections, a process described in the ISI protocol

as enrollment, the application must inform the ISI engine about the set of network

variables applicable to the pending enrollment. Similarly, when the application opens an
ISI enrollment, it must inform the ISI engine how to describe the enrollment.
ISI enrollments can describe a large variety of network variable sets that are available

for connections. In the following example, which builds on the simple digital actuator
example, the enrollment information simply is “any SNVT_switch network variable”.
Following is the application algorithm and interface for this example application:

#include <snvt_cfg.h>
#include "io.nc"

#pragma num_alias_table_entries 4

boolean isiLed;

//
// Network variables
//
network input SNVT_switch nviSwitch;

//
// Configuration properties
//
// The SCPTnwrkCnfg configuration property must be
// implemented as a configuration network variable to ease
// transitions between self-installed and managed networks.
// This property defaults to CFG_EXTERNAL. This is
// the default value required by the LonMark Interoperability
// Guidelines, and is the best choice when using the device in a
// managed network. See the when(reset) task, below, for more
// details about application start-up.
//
network input SCPTnwrkCnfg cp cp_info(reset_required) nciNetConfig
= CFG_EXTERNAL;

//
// when(nv_update_occurs) executes when the referenced input network
// variable receives a new value. The current switch position is shown
// through LED2, while LED1 (and SW1) are used to implement the ISI
// user interface.
//
when(nv_update_occurs(nviSwitch))
{
SetLeds(isiLed, nviSwitch.state);
}

Observe that LED1 now provides ISI status information, and is driven through the
isiLed global variable.
The first part of starting and running the ISI engine is shown in the following code

snippet, including the reset logic, periodic calls into the IsiTickS() API, and processing
of any incoming messages destined for ISI:

//
// Include the ISI definitions and link with the ISI library. Use
// IsiFull.lib where possible. Use IsiPl3170.lib for a device that

Advertising