Digital sensor example – Echelon Mini EVK User Manual

Page 61

Advertising
background image

An application image for a device created by the Neuron C compiler will

contain self-identification information unless the #pragma disable_snvt_si

directive is used. See the Compiler Directives chapter of the Neuron C Reference
Guide
for more information.

Including self-identification and self-documentation data with a device makes

it easier to install, as it allows easy, plug-and-play style, integration in multi-

vendor networks. While self-identification and self-documentation simplify
installation, these methods do not expose any of the algorithms used within

the application.
L

ON

M

ARK

International

provides a procedure for developers to certify devices

as being interoperable. Certification confirms that the device is interoperable

in a networked system. L

ON

M

ARK

interoperable devices conform to all

ANSI/EIA/CEA-709.1 (EN14908-1) protocol layer 1 – 6 requirements as

specified by the L

ON

M

ARK

Layer 1 6 Interoperability Guidelines, and conform to

all aspects of application-layer design, as discussed in the L

ON

M

ARK

Application Layer Interoperability Guidelines.

Contact L

ON

M

ARK

International at

www.lonmark.org

for more details about

becoming a member and certifying your devices.

Digital Sensor Example

The following example application adds a Switch functional block to the previous

digital sensor example. The network variable output is changed to be a member
of the functional block. The functional block code is highlighted in bold. The

enable_sd_nv_names compiler directive is not required to implement functional

blocks, but simplifies network integration by putting network variable names in
the application image for a device. A network tool such as the LonMaker

Integration Tool is required to test this application.

#pragma enable_sd_nv_names
#pragma num_alias_table_entries 2
#pragma run_unconfigured

// Define the device interface
network input SCPTlocation cp cpLocation = {"Unknown"};
#pragma ignore_notused cpLocation
network output SNVT_switch nvoSwitch;

fblock SFPTswitch {

nvoSwitch implements nvoSwitch;

} fbSwitch external_name("Switch");

// Configure the I/O pins
IO_4 input bitshift numbits(8) clockedge(-) ioButtons;
IO_6 output bit ioButtonLd = 1;

// Read the MiniGizmo buttons
boolean GetButton(void) {
// Latch the button inputs
io_out(ioButtonLd, 0);
io_out(ioButtonLd, 1);

// Shift in and return TRUE if any buttons are pressed
return !((unsigned) io_in(ioButtons) == 0xFF);
}

Mini EVK User’s Guide

55

Advertising