Configuration properties, Serial actuator example – Echelon Mini EVK User Manual
Page 58
// Update LEDs when an nviLight upd
when(nv_update_occurs(nviLight)) {
ate is received
SetLED(nviLight.state && nviLight.value);
}
Serial Actuator Example
The following example application sends a string received from a network
variable to the serial port on a MiniGizmo. The output network variable is a
SNVT_str_asc structure containing a single field with a zero-terminated ASCII
string of up to 30 characters. The network variable code is highlighted in bold. A
network tool such as the LonMaker Integration Tool is required to test this
application.
#include
#pragma num_alias_table_entries 2
#pragma run_unconfigured
// Define the device interface
network input SNVT_str_asc nviString;
// 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");
}
Configuration Properties
A configuration property (CP) is a data item that, like a network variable, is
part of the device interface for a device. Configuration properties
characterize the behavior of a device in the system. Network tools manage
this attribute and keep a copy of its value in a database to support
maintenance operations. If a device fails and needs to be replaced, the
configuration property data stored in the database is downloaded into the
replacement device to restore the behavior of the replaced device in the
system.
Configuration properties facilitate interoperable installation and
configuration tools by providing a well-defined and standardized interface for
configuration data. Each configuration property type is defined in a resource
52
Mini EVK User’s Guide