Echelon Neuron C User Manual

Page 207

Advertising
background image

Neuron C Reference Guide

187

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 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

Example:

if (MyFb1[0]::cpGain.divider == 0) {
// flag error indicating division by zero
}

The properties of the functional block’s network variable members can also be
accessed through an extension of this syntax. The syntax for accessing a

functional block’s member’s property is shown below (the

fb-context

syntactical

element is defined above):

fb-context

::

member-identifier

::

property-identifier

[ [

index-expr

] ]

Example:

MyTimer = MyFb1[0]::nvoValue::cpMaxSendT;

Neuron C provides the following built-in properties for a functional block (the

fb-

context

syntactical element is defined above):

fb-context

:: global_index

The global_index property is an unsigned short value that provides the global
index assigned by the compiler. The global index is a read-only value.

fb-context

:: director (

expr

)

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.
For more information about functional blocks and accessing their members and
properties, including examples, see Chapter 5,

Using Functional Blocks to

Implement a Device Interface

, in the

Neuron C Programmer’s Guide

.



Advertising