Self-installation, Serial actuator example – Echelon Mini EVK User Manual
Page 64

// Update LEDs when an nviLight update is received
when(nv_update_occurs(nviLight)) {
SetLED(nviLight.state && nviLight.value);
}
Serial Actuator Example
The following example application adds an Open Loop Actuator functional block
to the previous serial actuator example. The network variable input is changed
to be a member of the functional block. The functional block code is highlighted
in bold. A network tool such as the LonMaker Integration Tool is required to test
this application.
#include
#pragma enable_sd_nv_names
#pragma num_alias_table_entries 2
#pragma run_unconfigured
// Define the device interface
network input SNVT_str_asc nviString;
fblock SFPTopenLoopActuator {
nviString implements nviValue;
} fbSwitch external_name("Serial Out");
// Configure the I/O pins
IO_10 output serial baud (4800) ioSerialOut;
// 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));
}
}
// Print the network variable value when an nviString update
// is received
when(nv_update_occurs(nviString)) {
PrintConsole(nviString.ascii);
// Print new line
PrintConsole("\n\r");
}
Self-installation
The network inputs and outputs described in the Input/Output section must
be connected to cause the data sent by an application to an output network
variable to be received by another application via a network variable input.
These connections may be created by a network tool such as the LonMaker
Integration Tool, or by your device application with the Neuron C ISI library.
Networks can start out as self-installed networks using ISI and, as size or
complexity grows beyond the ISI limits, can be upgraded into a managed
58
Mini EVK User’s Guide