Poll( ) built-in function, Syntax, Example – Echelon Neuron C User Manual

Page 139

Advertising
background image

Neuron C Reference Guide

119

...
if

(offline){

// Perform offline cleanup

...
offline_confirm();
}
}

poll( )

Built-in Function

The poll( ) built-in function allows a device to request the latest value for one or

more of its input network variables. Any input network variable can be polled at

any time. If an array name without an index is used, then each element of the
array is polled. An individual element can be polled by using an array index.
When writing a Neuron hosted application in Neuron C, the input network

variable does not need to be declared as polled. However, you must declare input
network variables that will use the poll( ) function, or an equivalent API, as

polled when writing model files for host-based device development.
The new, polled value can be obtained through use of the nv_update_occurs
event.
If multiple devices have output network variables connected to the input network
variables being polled, multiple updates are sent in response to the poll. The

polling device cannot assume that all updates are received and processed

independently. This means it is possible for multiple updates to occur before the
polling device can process the incoming values. To ensure that all values sent are

independently processed, the polling device should declare the input network

variable as a synchronous input.

An input network variable that is polled with the poll( ) function consumes an

address table entry when it is bound to any output network variables.
The device interface file must identify all polled network variables. This
identification occurs automatically, however, a device’s program ID must be

updated if poll( ) calls are added or deleted from an application.
See also the

Initial Value Updates for Input Network Variables

section in

Chapter 3 of the

Neuron C Programmer’s Guide

for additional guidance about

how to use the poll( ) function.

Syntax

void poll ([

network-var

]);

network-var

A network variable identifier, array name, or array

element. If the parameter is omitted, all input network
variables for the device are polled.

Example

network input SNVT_privacyzone nviZone;

...
poll(nviZone);
...

Advertising