beautypg.com

Echelon ISI User Manual

Page 74

background image

ISI Programmer’s Guide

72

formatted as a network variable update. Include an explicit address for the

message with addressing details from an application-level address table and
identify the message as using the acknowledged service, and then explicitly send

the message.

E

XAMPLE

The following example shows the construction of a CSMOEX for an
acknowledged connection, and monitors DRUMs to update subnet and node
IDs in a device that allows connections to one other device. The

isiFlagExtended flag is required for transmitting this CSMOEX (but not for

receiving).

static const IsiCsmoData myCsmoData = {
ISI_DEFAULT_GROUP,

//

Group

isiDirectionOutput,

//

NV

direction

1,

//

Width

2,

//

Profile

number

(2

=

//

SFPTopenLoopSensor)

76u, //

Network

variable

type

index

//

(76

=

SNVT_freq_hz)

0,

//

Variant

(0

=

standard)

1,

//

Acknowledged

0,

//

Poll

isiScopeStandard,

// Scope that defines FPT or NVT

{0x9F, 0xFF, 0xFF, 0x05, 0x00, 0x05}, // application

1

//

Network

variable

member

//

number

(1

=

nvoValue)

};

typedef struct {

unsigned NeuronId[NEURON_ID_LEN];

unsigned subnet;

unsigned node;

} AddressTracker;

AddressTracker eeprom addressTracking = {

{0,0,0,0,0,0}, 0, 0

};

when (msg_arrives) {
IsiMessage

msg;

if (IsiApproveMsg()) {

// Prior to calling IsiProcessMsg(), pre-process DRUM

// messages by updating the AddressTracker
memcpy(&msg,

msg_in.data,

sizeof(IsiMessage));

if (msg.Header.Code == isiDrum) {

if

(memcmp(addressTracking.NeuronId,

msg.Msg.Drum.NeuronId, NEURON_ID_LEN) == 0) {

addressTracking.subnet = msg.Msg.Drum.SubnetId;
addressTracking.node = msg.Msg.Drum.NodeId;

}

}

// Call the ISI message handler

(void)

IsiProcessMsgS();

}
}

The addressTracking variable maintains the current subnet/node ID pair for the
device with the Neuron ID that is also kept in the addressTracking variable. The