Examples of network variable declarations – Echelon Neuron C User Manual

Page 60

Advertising
background image

48

How Devices Communicate Using Network Variables

After the device design is complete, you specify connections between network

variable outputs and inputs on different devices. This is discussed in

Connecting

Network Variables

on page 49. The specification of the desired connections is

used by a network tool to generate the appropriate network addresses. When

these addresses are downloaded into the devices, they ensure that updates sent
by writers reach all of the intended readers.
In the lamp and switch example shown in Figure 6 on page 46, the output
network variables in column 1 are connected to the input network variables in

column 2, as listed in Table 7.

Table 7. Connecting Output Network Variables

Output (device/variable_name)

Input (device/variable_name)

switch1/nvoSwitch lamp1/nviLamp

lamp2/nviLamp

switch2/nvoSwitch lamp3/

nviLamp

When a network variable that is a structure is modified by a network variable

writer, the entire structure is updated at the next critical section boundary for all
network variable readers, regardless of whether the structure was wholly or

partially modified.
Network variables can be declared with a single dimension array bound. Each
element of the array is then a separately bindable network variable. See the

descriptions of the poll( ) function, the built-in nv_array_index variable, and the
nv_update_completes, nv_update_fails, nv_update_occurs, and

nv_update_succeeds events in the

Neuron C Reference Guide

for more

information.

When an element of a network variable that is an array is modified by a network

variable writer, only the modified element is updated at the next critical section.
The maximum size of a network variable is 31 bytes. In the case of a network
variable array, each element is limited to a size of 31 bytes.
The Neuron C compiler includes the SNVT indices (numerical identifiers for the

standard network variable types) in the application image for all network
variables declared as SNVTs, and optionally also includes the network variable

names for all network variables. Network variable names are always included in

the device interface file for a device, but integrators might find them useful when
they lose the device interface file and need to install your device. You can control

these options using the following compiler directives as described in the

Compiler

Directives

chapter of the

Neuron C Reference Guide

:

#pragma disable_snvt_si
#pragma enable_sd_nv_names

See the

Neuron C Reference Guide

for additional information about the syntax

for declaring a network variable.

Examples of Network Variable Declarations

Some sample network variable declarations are the following:

Advertising