Serial actuator example – Echelon Mini EVK User Manual

Page 70

Advertising
background image

// Call IsiInitiateAutoEnrollment() after a specified period has
// passed
void IsiUpdateUserInterface(IsiEvent Event, unsigned Parameter) {
if (Event == isiWarm &&
!IsiIsConnected(nviLight::global_index)) {
IsiInitiateAutoEnrollment(&MyCsmoData,
nviLight::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
}

Serial Actuator Example

The following example application adds ISI support to the previous serial

actuator example. The network variable input is changed to a switch input, and

may be automatically connected to all digital sensors in the network programmed
to accept enrollment from a SFTPopenLoopActuator functional block. The ISI

code is highlighted in bold.

#include <string.
#include <isi.h>

h>


#pragma enable_sd_nv_names
#pragma num_alias_table_entries 2

// Define the device interface
network input SNVT_switch nviSwitch;

fblock SFPTopenLoopActuator {

nviSwitch implements nviValue;

} fbSwitch external_name("Serial Out");

// Configure the I/O pins
IO_10 output serial baud (4800) ioSerialOut;

// Start the ISI engine
when(reset) {
IsiStartS(isiFlagNone);
}

// Process ISI Messages
when(msg_arrives) {
if (IsiApproveMsg()) {
(void)IsiProcessMsgS();
}
}


// Send a string to the serial port
const char errorString[] = "String too long.";
void PrintConsole(const char *message) {
if (strlen(message) <= 100) {
io_out(ioSerialOut, message, (unsigned) strlen(message));
} else {
io_out(ioSerialOut, errorString,
(unsigned) strlen(errorString));
}

64

Mini EVK User’s Guide

Advertising