110 and – Echelon Neuron C User Manual

Page 122

Advertising
background image

110

Using Functional Blocks to Implement a Device Interface

1

Use the NodeBuilder Resource Editor to create a user functional profile

with the same functional profile key as the standard functional profile
that you want to inherit from.

2 Set

Inherit Members from Scope 0 in the functional profile definition.

This setting makes all members of the standard functional profile part of
your user functional profile.

3

Add your additional members to the new user functional profile.

4

Declare a functional block based on the new user functional profile.

This method provides better documentation and easier reusability than using

implementation-specific members.

Accessing Members and Properties of a
Functional Block from a Program

You can access the network variable and configuration property members of a

functional block from a program just as you can access any other variable. For

example, members can be used in expressions, as function parameters, or as
operands of the address operator or the increment operator. To access a network

variable member of a functional block, or to access a network variable

configuration property of a functional block, the network variable reference can
be used in the program just as any other variable would be.
However, to use a CP family member, you must specify which family member is

being accessed, because more than one functional block could have a member
from the same CP family. The syntax for accessing a configuration property from

a functional block’s property list uses the Neuron C context operator, a double

colon, as follows:

fb-context

::

property-identifier

[ [

index

-

expr

] ]

fb-context : identifier

[

index

-

expr

]

identifier

The particular CP family member is identified by a qualifier that precedes it.

This qualifier is called the

context

. The context is followed by two consecutive

colon characters, and then the name of the property. The context uniquely

identifies the property. For example, a functional block array, fba, with 10

elements, could be declared with a property list referencing a CP family named
cpXyz. There would then be 10 different members of the CP family cpXyz, all

with the same name. However, adding the context, such as fba[4]:: cpXyz, or

fba[j]:: cpXyz, would uniquely identify the CP family member.

Just like for network variable properties, even though a configuration network

variable can be uniquely accessed through its variable identifier, it can also be

accessed equally well through the context expression, just like the CP family
members.
Also, the network variable members of the functional block can be accessed
through a similar syntax. The syntax for accessing a functional block member is

shown below (the

fb-context

syntactical element is defined above):

fb-context

::

member

-

identifier

Advertising