Echelon Neuron C User Manual

Page 118

Advertising
background image

106

Using Functional Blocks to Implement a Device Interface

added per line. In this way, a functional block can contain an NV array with the

elements declared as consecutive NV members.

At the end of the member list there is an optional item that permits the

specification of a director function. The director function specification begins

with the director keyword, followed by the identifier that is the name of the
function, and ends with a semicolon.
Example:

network output SNVT_amp nvoAmpere;

extern void MeterDirector(unsigned fbIdx, unsigned cmd);

fblock SFPTopenLoopSensor {

nvoAmpere implements nvoValue;

director

MeterDirector;

} fbAmpereMeter;

See

The Director Function

on page 113 for more details about directors.

After the member list, the functional block declaration continues with the name
of the functional block itself. A functional block can be a single declaration, or it

can be a singly dimensioned array.
If the functional block is implemented as an array as shown in the example
below, then each network variable that implements a member of that functional

block must be declared as an array of at least the same size. When implementing

the fblock array’s member with an array network variable element, the starting
index of the first network variable array element in the range of array elements

must be provided in the implements statement. The Neuron C compiler
automatically adds the following network variable array elements to the fblock

array elements, distributing the elements consecutively.
Example:

network output SNVT_lev_percent nvoValue[6];

// The following declares an array of four fblocks,
// with "nvoAnalog" members implemented by the
// network variables nvoValue[2] .. nvoValue[5],
// respectively.

fblock SFPTanalogInput {

nvoValue[2] implements nvoAnalog;

} myFb[4];

You can provide an optional external name for each functional block. To specify

an external name, use the external_name keyword, followed by a string of up to

16 characters in parentheses. The string becomes part of the device interface
which is exposed to network tools.
Alternatively, you can provide an optional external name that is specified by a

language string in a resource file using the external_resource_name keyword. In
this case, the device interface information contains a scope and index pair (the

first number is a scope, then a colon character, then the second number is an

index). The scope and index pair identifies a language string in a resource file,
which a network tool can access for a language-dependent name of the functional

block. You can use the scope and index pair to reduce memory requirements and

Advertising