beautypg.com

The dynamic interface example application – Echelon FTXL User Manual

Page 214

background image

202

Example FTXL Applications

For more information about creating and using a model file, see

Creating a Model

File

on page 23.

To change the L

ON

W

ORKS

interface and functionality of the example application,

perform the following steps:

1. Define the interface in the Simple Example.nc model file.

2. Run the LonTalk Interface Developer utility to generate an updated

application framework.

3. Make appropriate changes to the callback handler functions in the

FtxlHandlers.c file or the main.c file.

4. Rebuild the project.

5. Optional: Load the generated XIF file into the FTXL Transceiver.
6. Load the new executable file into the Nios II processor.

The Dynamic Interface Example Application

The dynamic interface example application demonstrates the basics of using both
dynamic network variables and the L

ON

M

ARK

changeable-type protocol in an

FTXL application. The example is not a complete implementation of the protocol,

but is meant to serve as a starting point for writing your own application.

To demonstrate dynamic network variables, the example application allows you

to add, modify, or delete network variables of type SNVT_amp. Each output

dynamic network variable represents the aggregated current consumption of one
or more input dynamic network variables. For this example, the output dynamic

network variables represent logical circuits. You can define as many circuits as

needed, but the total number of dynamically added network variables can be no
more than 50.
The dynamic network variables must use the following naming convention:

• For output network variables, use the name nvoAmp plus a single-

character suffix that represents a particular logical circuit.

• For input network variables, use the name nviAmp, plus the suffix for the

corresponding output network variable, with an additional suffix that

identifies the particular input. The additional suffix can be one or more
characters.

Example: For logical circuit A, you could name the output network variable

nvoAmpA, and you could name three of its input network variables nviAmpA01,
nviAmpA02, and nviAmpA03. The value of the nvoAmpA network variable

would be the aggregrate sum of the values of the three input network variables.
The example application maintains an array for a map of the circuits defined for
the device. The application uses the functions described in

Application-Specific

Utility Functions

on page 213 to maintain the circuits of dynamic network

variables and to propagate them to the network.
To demonstrate changeable-type network variables, the example application has

a configuration network variable (CPNV) named nciNvType, which maintains the
current type and last-known good value of the two network variables, nviVolt and

nvoVoltFb. The application supports changing the network variable type for

these two network variable between the default type (SNVT_volt) and the