Echelon Neuron C User Manual

Page 215

Advertising
background image

Neuron C Reference Guide

195

When an nv_update_occurs event is TRUE, the nv_in_addr variable is set to

contain the L

ON

W

ORKS

addressing information of the sending device. The type is

a structure predefined in the Neuron C language as shown below:

typedef struct {

unsigned

domain :

1;

unsigned flex_domain : 1;

unsigned

format :

6;

struct

{

unsigned

subnet;

unsigned

: 1;

unsigned node

: 7;

}

src_addr;

struct

{

unsigned

group;

}

dest_addr;

} nv_in_addr_t;
const nv_in_addr_t nv_in_addr;

The various fields of the network variable input address structure are:

domain

Domain index of the network variable update.

flex_domain

Always 0 for network variable updates.

format

Addressing format used by the network variable update.
Contains one of the following values:

0

Broadcast

1 Group
2 Subnet/Node

3 Neuron

ID

4 Turnaround

src_addr

Source address of the network variable update. The

subnet and node fields in the src_addr are both zero (0)
for a turnaround network variable.

dest_addr

Destination address of the network variable update if

group addressing is used as specified by the format field.

When the nv_in_addr variable is used in an application, its value corresponds to

the last input network variable updated in the application. The contents of

nv_in_addr are undefined if no network variable update event has occurred.
Updates occur when network variable events are checked or when post_events( )

is called (either explicitly from the program or by the scheduler between tasks)

and events arrive for network variables for which there is no corresponding event
check.
See

Monitoring Network Variables

in Chapter 3,

How Devices Communicate

Using Network Variables,

of the

Neuron C Programmer's Guide

for more

description of how nv_in_addr is used.
Use of nv_in_addr enables explicit addressing for the application, and affects the
required size for input and output application buffers. See Chapter 8,

Memory

Management,

of the

Neuron C Programmer's Guide

for more information about

allocating buffers.

Advertising