Advanced neuron c concepts, Event-driven vs. polled scheduling, Low-level messaging – Echelon Mini EVK User Manual

Page 71

Advertising
background image

}

// Print the network variable value when an nviSwitch update
// is received
when(nv_update_occurs(nviSwitch)) {
PrintConsole(nviSwitch.value ? "On\n\r" : "Off\n\r");
}

// Call IsiTick() every 250 milliseconds
mtimer repeating isiTimer = 250;

when(timer_expires(isiTimer)) {
IsiTickS();
}

// MyCsmoData defines the connection details for the automatic
// ISI network variable connection advertised by this device
static const IsiCsmoData MyCsmoData =
{ ISI_DEFAULT_GROUP, isiDirectionInput, 1, 4, 95u, 0 };

// Call IsiInitiateAutoEnrollment() after a specified period
// has passed
void IsiUpdateUserInterface(IsiEvent Event, unsigned Parameter) {
if (Event == isiWarm &&
!IsiIsConnected(nviSwitch::global_index)) {
IsiInitiateAutoEnrollment(&MyCsmoData,
nviSwitch::global_index);
}
#pragma ignore_notused Parameter
}

// Create the CSMR messages to be periodically sent
void IsiCreateCsmo(unsigned Assembly, IsiCsmoData* pCsmoData) {
memcpy(pCsmoData, &MyCsmoData, sizeof(IsiCsmoData));
#pragma ignore_notused Assembly
}

Advanced Neuron C Concepts

This section discusses advanced Neuron C concepts.

Event-Driven vs. Polled Scheduling

Although the Neuron C applications typically use event-driven network
variable updates, Neuron C also allows you to construct polled networks

variables that are only updated when requested by another device or tool.

Chapter 3, How Devices Communicate Using Network Variables, of the Neuron C
Programmer’s Guide
provides further information on polling.

Low-Level Messaging

In addition to the functional block and network variable communication
model, Neuron C also supports application messages. You can use

application messages—in place of or in conjunction with network variables—

to implement proprietary or standard special-purpose interfaces to your
devices. Standard special-purpose interfaces include the L

ON

W

ORKS

file

transfer protocol and the ISI protocol. Application messages are described in

Mini EVK User’s Guide

65

Advertising