Tool, 112 for mor – Echelon Neuron C User Manual

Page 124

Advertising
background image

112

Using Functional Blocks to Implement a Device Interface


// reference of CP family, not CP family member
cpGain.multiplier = 123;

//

'::' instead of '.'

fbAmpereMeter[0]::cpGain[i]::multiplier = 123;

Neuron C also provides some built-in properties for a functional block. The built-

in properties are shown below (the

fb-context

syntactical element is defined

above):

fb-context

:: global_index

fb-context

:: director (

expr

)

The global_index property is an unsigned short value that corresponds to the

global index assigned by the compiler. The global index is a read-only value. The

global index ranges from 0 (zero) to 253, with each fblock and element of an
fblock array having a unique index. The order of the fblock index follows the

order in which the fblock declarations are compiled.
Use of the director property as shown calls the director function that appears in
the declaration of the functional block. The compiler provides the first parameter

to the actual director function automatically (the first argument is the global

index of the functional block), and the

expr

shown in the syntax above becomes

the director function’s second parameter. This second parameter is usually

referred to as unsigned uCommand, however, the compiler passes any value of
type unsigned without imposing any special interpretation.
The director property can be used in any case, no matter whether a director

function is defined for this individual fblock, shared among various fblocks, or not
defined at all. In case no actual director function is defined, use of the director

property does not cause a compilation or run-time error. The firmware support

for the director property handles the case of an undefined director function by
taking no action other than just returning to the calling program.
For more about the director property, the global_index property, and for

examples showing their use, see

The Director Function

on page 113.

Accessing Members and Properties of a
Functional Block from a Network Tool

Network tools can implement whatever representation suits the tool’s user

interface and purpose best. The LonMaker Integration Tool, for example, focuses

on a graphical representation of functional blocks and member network
variables. Configuration properties are typically represented by custom controls

in specialized configuration software, such as an LNS device plug-in.
For example, the cpGain property from the example above might be presented as
a slider for graphical adjustment of the gain factor with the mouse or cursor keys.
However, most tools also supply some textual reference to configuration
properties. When listing configuration property members, those members are

typically listed using or including their type name, for example,

SCPTupdateRate”

or

“UCPTboosterControl”

.

Because a functional block can only implement one configuration property of a

given type, this naming scheme provides unique names. To avoid confusion

Advertising