Mini EVK User’s Guide Revision 3 @ 078-0302-01D ®
Echelon, LONWORKS, LonMaker, LonTalk, Neuron, 3120, 3150, LONMARK, NodeBuilder, and the Echelon logo are trademarks of Echelon Corporation registered in the United States and other countries. LonScanner, ISI, i.LON and OpenLDV are trademarks of Echelon Corporation. Other brand and product names are trademarks or registered trademarks of their respective holders.
Welcome This document describes how to use the Mini EVK Evaluation Kit. You can use the Mini EVK to develop a prototype or production control system that requires networking, particularly in the rapidly growing, price-sensitive mass markets of smart light switches, thermostats, and other simple devices and sensors. You can also use the Mini EVK to evaluate the development of applications for such control networks using the LONWORKS® platform.
Mini EVK vs. NodeBuilder Tool Comparison ........................................ 2 Mini EVK Contents ................................................................................. 3 Installing the Mini EVK Software ................................................................ 4 Document Roadmap ....................................................................................... 5 Using the Mini Application.............................................................................
Analog Sensor Example.................................................................. 60 Digital Actuator Example............................................................... 63 Serial Actuator Example ................................................................ 64 Advanced Neuron C Concepts ..................................................................... 65 Event-Driven vs. Polled Scheduling ..................................................... 65 Low-Level Messaging ..........................
iv Mini EVK User’s Guide
1 Introduction This chapter introduces the Mini EVK, and describes how to install the Mini EVK software. It also provides a roadmap to follow when reading this document and learning how to use the Mini EVK.
Introducing the Mini Evaluation Kit Echelon’s Mini EVK Evaluation Kit is a tool for evaluating the development of control network applications with the ANSI/CEA-709.1 (EN14908) Control Network Protocol. You can use the Mini EVK to develop a prototype or production control system that requires networking, particularly in the rapidly growing, price-sensitive mass markets of smart light switches, thermostats, and other simple devices and sensors.
Feature Application Code and Constant Data per Device* Mini EVK 32Kbyte maximum Code Wizard No Plug-in Wizard No Debugger No Project Manager No Integrated Development Environment No Network Installation Tool NodeBuilder Tool 64Kbyte maximum Application loader only Complete network installation and test tool Target Hardware Evaluation boards with 64KByte flash memory Development platform with 64KByte flash and 32KByte RAM; compatible with any standard or custom hardware platform I/O Boar
The Mini EVK software includes the following applications and examples: • Mini Application, which you can use to manage Neuron C code, build Neuron C applications, and download those applications into the evaluation boards. For more information on the Mini Application, see Chapter 2, Using the Mini Application. For more information on the Neuron C and C# example applications, see Chapter 3, Using the Mini EVK Example Applications.
7. Click Install to begin the installation. When the installation has completed, a window appears to notify you. Click Finish to exit the installation wizard. 8. If you do not have an Adobe Acrobat reader, you can install it by selecting Install Adobe Acrobat Reader in the Install Products windows described in step 2. 9.
6 Mini EVK User’s Guide
2 Using the Mini Application This chapter describes how to use the Mini Application to build a Neuron C application image, and how to download an application image into a device. This chapter also describes how to use the Mini Application to reset, wink or test a device.
Starting the Mini Application You can use the Mini Application to build an application image for a Neuron C application, download the application image into a device, and then test the basic functionality of the application. The remainder of this chapter describes how to perform these tasks. To start the Mini Application, click the Windows Start menu, point to All Programs, point to the Echelon Mini EVK program folder, and then click Mini EVK Application. The Application tab opens. Figure 2.
EVK example Neuron C applications with the Mini Application. To create a Neuron application image, follow these steps: 1. Start the Mini Application and click the Application tab, as described in the previous section. You will use the Application tab to select a Neuron C file, optionally select any libraries, select a hardware template, define the program ID, and build the Neuron application image. 2. Enter the Neuron C source file in the first Neuron C Source and Library File Names box.
To build an application image for the example Neuron C applications, you must select the correct library as shown in Table 2.1. For more information on the ISI libraries, see the ISI Programmer’s Guide. Table 2.1 ISI Libraries Example Application ISI Library MGDemo IsiFull.lib MGSwitch, MGLight IsiCompactManual.lib MGKeyboard IsiCompactAuto.lib 5. Enter the hardware template for the device in Target Hardware box.
a network. The program ID includes fields that define the manufacturer, device class, device subclass, transceiver type, and model number for a device type. If you are compiling one of the example applications included with the Mini EVK, you can use any program ID, as long as you use a different program ID for each different application image. To match the application images provided with the Mini EVK, enter one of the program IDs from Tables 2.3 and 2.4 for the example applications. Table 2.
Figure 2.2 Standard Program ID Calculator Dialog 8. Click Build to compile the application and create the application image. The status box at the bottom of the Application tab will inform you when the application has successfully compiled, and will also inform you of any build errors. Consult Appendix A, Troubleshooting, if you are unable to compile your application.
1. Click the Device tab. You will use the Device tab to connect to a device and load the Neuron application image into the device. Figure 2.3 Device Tab 2. Select a network interface from the Network Interface box, and then click Connect to connect the Mini Application to the network interface. The Status bar at the bottom of the window indicates whether or not the Mini Application is connected to a network interface.
Mini EVK Hardware Guide. For more information on installing and configuring the U10 or U20 USB Network Interface, and on using it to attach your computer to a network channel, see the LONWORKS USB Network Interface User’s Guide. WARNING: Only one application can use a network interface at a time, so if you connect the Mini Application to a network interface, you cannot use that network interface with other applications.
On a Mini EVB, the service pin button is the black button labeled “SERVICE.” When the Mini Application receives the service pin message, it displays the Neuron ID in the Neuron ID box on the Add Device dialog. Click OK to add the device. You can also add a device using the Service button without opening the Add Device dialog first by pressing the device’s Service button. This opens the Service Pin Message window, which you can use to add the device.
The PL Evaluation Board will enter CENELEC configuration mode every time you load an application into it (as well as the first time you power up the Evaluation Board). If you want to disable this behavior for any of the Mini example applications, you can do so by commenting out the following line in the Neuron C source file: #define SUPPORT_CCL For more information on CENELEC configuration mode, see the CENELEC Config Readme.
Program ID Segment Field Description M:MM:MM Manufacturer A 20-bit identifier for the device manufacturer. Click the arrow to select from a list of all the LONWORKS device manufacturers who are members of LONMARK International. If your company is a member of LONMARK International but is not included in the list, download the latest program ID data from www.lonmark.org/spid. If your company is not a member of LONMARK International, get a temporary manufacturer ID from www.lonmark.org/mid.
Program ID Segment CC Field Device Class Description A 16-bit identifier for the primary function of the device. The primary function of the device is determined by the primary functional profile implemented by your device. Your application will implement at least one functional profile, and may implement multiple functional profiles. If you implement multiple functional profiles, determine which is the primary based on the most typical usage of your device.
Program ID Segment UU Field Usage Description An 8-bit identifier for the intended usage of the device. The most significant two bits are determined by the Has Changeable Interface and Use Field Valued Defined By Functional Profile check boxes below the Usage box. If you are using a standard usage value, set the Defined By Functional Profile check box, click the arrow to select from a list of standard usage values maintained by LONMARK International.
Program ID Segment N/A Field Description Has Changeable Interface Select this check box to indicate that the device has a changeable device interface, or if the device has any network variables with changeable types. See the Neuron C Programmer’s Guide for more information on changeable type network variables. N/A Usage Field Values Defined By Functional Profile Select this check box if the primary functional profile implemented by this device defines usage values.
Mini EVK User’s Guide 21
3 Using the Mini EVK Example Applications This chapter describes how to use the Neuron C and C# example applications included with the Mini EVK.
Mini EVK Example Applications The Mini EVK includes the following example applications: • MGDemo • MGSwitch • MGLight • MGKeyboard • Monitoring & Control The MGDemo, MGSwitch, MGLight, and MGKeyboard applications are Neuron C applications that you can load into your evaluation boards and use to create simple LONWORKS networks. For more information on these applications, see the Neuron C Example Applications section below. These examples use the Interoperable Self-installation (ISI) library.
2. If you are using an FT Mini EVK, skip to the next step. If you are using a PL Mini EVK and this is the first time you use a PL EVB or if you have just reloaded an example application, LED1 will flash, indicating that the EVB is in CENELEC configuration mode. The CENELEC access protocol is a European-standard protocol for controlling access to a power line used for communication. It is required for PL-20 devices in most of Europe, but is not required or typically used outside of Europe.
MGSwitch and MGLight Example Applications You can use the MGSwitch and MGLight example applications to demonstrate how simple switch and lamp devices work on a LONWORKS network, where the switch devices are used to activate or de-activate the lamp devices, or to set the lighting level for the lamp devices. When you use these applications, the evaluation boards running the MGSwitch application represent the switch devices.
LED on the MiniGizmo attached to the evaluation board running the MGDemo application will activate or de-activate each time the MGSwitch MiniGizmo sends an update. In addition, the MGDemo application implements LED1 – LED4 as simple lights that cannot be dimmed. These LEDs will be illuminated whenever the lighting level on the MGSwitch evaluation board is more than zero.
board used in this step is referred to as the MGDemo board in this section. 2. To demonstrate monitoring and controlling a device from your computer, run the Monitoring & Control Example Application as described in the Monitoring & Control Example Application on page 29. You do not need to connect the evaluation board to any other evaluation boards (as described in steps 3 – 5 of this procedure) to use the Monitoring & Control Example Application. 3.
the I/O LEDs on all other connected evaluation boards running the MGDemo application will activate. When you press the I/O button again, the I/O LEDs will de-activate. For more information on the MGSwitch and MGLight applications, see MGSwitch and MGLight Example Application on page 25. You can also use the MGDemo application to interoperate with evaluation boards running the MGKeyboard application, as described in the next section, MGKeyboard Example Application.
Monitoring & Control Example Application You can use the Monitoring & Control Example Application to monitor a 3150 EVB running the MGDemo example application. You can also use this application to monitor ISI messages from any devices on the same network. The Monitoring & Control Example Application is a Windows application written in Microsoft Visual C#. It requires Microsoft .NET Framework 1.1 to run. The Microsoft .
WARNING: If you want to use a PCC-10, PCLTA-20, or PCLTA-21 network interface, you must configure it as a layer 5 interface. See the Mini EVK Hardware Guide for more information on this. Figure 3.2 Monitoring & Control Application Main Window 4. Select a target device running the MGDemo application in the Device box. Click the arrow to view any devices that you have recently added or that have been automatically discovered through the ISI protocol.
Figure 3.3 Add Device Dialog If you clicked the Add button, enter the Neuron ID of the target device in the Neuron ID box, and then click OK to return to the window shown in Figure 3.2. The Neuron ID is a unique 48-bit (12-hex digit) identifier contained in every LONWORKS device. The Monitoring & Control Example Application uses the Neuron ID to communicate with your selected device. For more information on Neuron IDs, see Introduction to the LONWORKS System in the Echelon Mini EVK program folder.
Figure 3.4 ISI Information Window The subnet ID, node ID, and Neuron ID of the network interface used by the Monitoring & Control Application are displayed in the Local Network Interface box. The subnet ID, node ID, and Neuron ID of the last device to send an update over the channel are displayed in the Last Device to Send Update box. You can force an ISI collision to see how the ISI protocol recovers from ISI collisions.
IsiUpdateUserInterface() and IsiDiagnostics() calls on the remote device. Consult the ISI Programmer’s Guide for more information on these calls. You can also manually change the Mini computer’s network interface subnet and node IDs by following these steps: 1. Click Change Subnet/Node ID. This opens the dialog shown in Figure 3.5. Figure 3.5 Change Subnet/Node ID Dialog 2. Enter the subnet ID in the Subnet ID box, and the node ID in the Node ID box.
4 Developing a Neuron C Application This chapter introduces the Neuron C Version 2.1 programming language, and provides an overview on how to use the LONWORKS platform and the Neuron C programming language to construct interoperable devices and systems. The chapter also introduces key concepts of Neuron C such as event-driven scheduling, network variables, configuration properties, and functional blocks.
What Is Neuron C? Neuron C Version 2.1 is a programming language based on ANSI C that you can use to develop applications for Neuron Chips and Smart Transceivers. It includes network communication, I/O, and event-handling extensions to ANSI C, which make it a powerful tool for the development of LONWORKS applications.
the look and feel of a normal variable to the C program, with the addition of controlled access by network configuration tools. Neuron C also provides a way to organize the network variables and configuration properties in the device into functional blocks, each of which provides a collection of network variables and configuration properties, that are used together to perform one task. These network variables and configuration properties are called the functional block members.
Neuron C provides many built-in I/O objects. These I/O objects are standardized I/O device drivers for the Neuron Chip or Smart Transceiver I/O hardware. Each I/O object fits into the event-driven programming model. A function-call interface is provided to interact with each I/O object.
Declarations using extern references can be used to provide forward references to variables, and function prototypes must be declared to provide forward references to functions.
Variable Initialization Initialization of variables occurs at different times for different classes. The const variables, except for network variables, must be initialized. Initialization of const variables occurs when the application image is first loaded into the Neuron Chip or Smart Transceiver. The const ram variables are placed in off-chip RAM that must be non-volatile.
•Configuration Properties SCPTdefOutput cp_family cpDefaultOut; •Functional Blocks fblock SFPTnodeObject { … } myNode; •Message tags msg_tag command; Getting Started with Neuron C This section introduces Neuron C with a series of examples. Neuron C concepts are introduced one at a time, and each concept is integrated into the following examples: • A digital sensor that senses a push button. • An analog sensor that reads a temperature value. • A digital actuator that controls an LED.
devices include temperature and position sensors, valves, switches, and LED displays. Neuron Chips and Smart Transceivers can also be connected to other microprocessors. The Neuron firmware implements numerous I/O objects that manage the interface to these devices for a Neuron C application. I/O objects are discussed in detail in Chapter 2, Focusing on a Single Device, of the Neuron C Programmer’s Guide and in the Neuron C Reference Guide.
Document Title Contents Part Number Scanning a Keypad with the Neuron Chip Describes how a Smart Transceiver or Neuron Chip can be used to scan a simple 16-key switch matrix to provide a numeric or special-function keyboard without the use of a keyboard encoder.
#define DS18S20_SKIP_ROM #define DS18S20_CONVERT #define DS18S20_READ 0xCCu 0x44u 0xBEu // Get a temperature reading from the Touch temperature sensor SNVT_temp_p GetTemperature(void) { union { SNVT_temp_p snvtTempP; unsigned Bytes[2]; } CurrentTemperature; CurrentTemperature.snvtTempP = 32767l; if (touch_reset(ioThermometer)) { (void) touch_byte(ioThermometer, DS18S20_SKIP_ROM); (void) touch_byte(ioThermometer, DS18S20_READ); CurrentTemperature.
output port. This connects the IO10 output to an EIA-232 line driver that is in turn connected to pin 2 as a serial data output on the RS-232 connector. // 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.
Digital Sensor and Serial Actuator Example The following example application reads the MiniGizmo push buttons every 50 milliseconds and sends an “On” or “Off” value to the serial port if it has changed. A value of On means any of the buttons is pressed, and a value of Off means all the buttons are off. The timer code is highlighted in bold. #include
#pragma enable_io_pullups #pragma num_alias_table_entries 2 #pragma run_unconfigured // Configure the I/O pins IO_7 touch ioThermometer; IO_10 output serial baud (4800) ioSerialOut; #define DS18S20_SKIP_ROM #define DS18S20_CONVERT #define DS18S20_READ 0xCCu 0x44u 0xBEu // Get a temperature reading from the Touch temperature sensor SNVT_temp_p GetTemperature(void) { union { SNVT_temp_p snvtTempP; unsigned Bytes[2]; } CurrentTemperature; CurrentTemperature.
static SNVT_temp_p lastTemperature; char temperatureString[15]; temperature = GetTemperature(); if (temperature != lastTemperature) { lastTemperature = temperature; // Convert temperature to a string and print s32_from_slong(temperature / 100, &s32_temperature); s32_to_ascii(&s32_temperature, temperatureString); PrintConsole(temperatureString); // Print new line PrintConsole("\n\r"); } } Digital Actuator Example The following example application toggles the state of the LEDs on a MiniGizmo once a second.
Applications exchange data with other LONWORKS devices using network variables. Every network variable has a direction, type, and length. The network variable direction can be either input or output, depending on whether the network variable is used to receive or send data. The network variable type determines the units, scaling, and encoding of the data. The LONWORKS platform defines standard types for network variables called standard network variable types (SNVTs).
Figure 4.2 Network Variable Multicast Connection Network variables greatly simplify the process of developing and installing distributed systems because devices can be defined, developed, and produced individually, then connected and reconnected easily into many new LONWORKS applications. Network variables are discussed in detail in Chapter 3, How Devices Communicate Using Network Variables, or the Neuron C Programmer’s Guide and also in the Neuron C Reference Guide.
// 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); } // Repeat every 50 milliseconds mtimer repeating scanTimer = 50; // Read the buttons when the timer expires when(timer_expires(scanTimer)) { boolean button; static boolean lastButton; button = GetButton(); if (button != lastButton) { lastButton = button; nvoSwitch.value = button ? 200U : 0; nvoSwitch.
= touch_byte(ioThermometer, 0xFFu); CurrentTemperature.Bytes[0] = touch_byte(ioThermometer, 0xFFu); if (touch_reset(ioThermometer)) { // Scale the raw reading CurrentTemperature.snvtTempP *= 50l; // start the next conversion cycle: (void) touch_byte(ioThermometer, DS18S20_SKIP_ROM); (void) touch_byte(ioThermometer, DS18S20_CONVERT); } else { CurrentTemperature.snvtTempP = 32767l; } } return CurrentTemperature.
// 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 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.
file that specifies the data encoding, scaling, units, default value, range, and behavior for configuration properties based on the type. A rich variety of standard configuration property types (SCPTs) are defined. SCPTs provide standard type definitions for commonly used configuration properties such as dead-bands, hysteresis thresholds, and message heartbeat rates.
Functional Blocks and Functional Profiles A device application is divided into one or more functional blocks. A functional block is a portion of a device’s application that performs a task by receiving configuration and operational data inputs, processing the data, and sending operational data outputs. A functional block may receive inputs from the network, hardware attached to the device, or from other functional blocks on a device.
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 multivendor networks.
// Repeat every 50 milliseconds mtimer repeating scanTimer = 50; // Read the buttons when the timer expires when(timer_expires(scanTimer)) { boolean button; static boolean lastButton; button = GetButton(); if (button != lastButton) { lastButton = button; nvoSwitch.value = button ? 200U : 0; nvoSwitch.state = button ? 1 : 0; } } Analog Sensor Example The following example application adds an Open Loop Sensor functional block to the previous analog sensor example.
CurrentTemperature.snvtTempP *= 50l; // start the next conversion cycle: (void) touch_byte(ioThermometer, DS18S20_SKIP_ROM); (void) touch_byte(ioThermometer, DS18S20_CONVERT); } else { CurrentTemperature.snvtTempP = 32767l; } } return CurrentTemperature.
// 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
network. Developing an application using the Neuron ISI library is described in the ISI Programmer’s Guide. Digital Sensor Example The following example application adds ISI support to the previous digital sensor example. The network variable output will automatically connect to all digital actuators offering connections in the network. The ISI code is highlighted in bold. #pragma enable_sd_nv_names #pragma num_alias_table_entries 2 #include
nvoSwitch.
#define DS18S20_CONVERT #define DS18S20_READ 0x44u 0xBEu // Get a temperature reading from the Touch temperature sensor SNVT_temp_p GetTemperature(void) { union { SNVT_temp_p snvtTempP; unsigned Bytes[2]; } CurrentTemperature; CurrentTemperature.snvtTempP = 32767l; if (touch_reset(ioThermometer)) { (void) touch_byte(ioThermometer, DS18S20_SKIP_ROM); (void) touch_byte(ioThermometer, DS18S20_READ); CurrentTemperature.Bytes[1] = touch_byte(ioThermometer, 0xFFu); CurrentTemperature.
when(timer_expires(serviceTimer)) { if (service_pin_state()) { ServicePinActivation++; if (ServicePinActivation > LONG_SERVICE_PIN) { IsiCancelEnrollment(); } } else if (ServicePinActivation) { if (isiState == isiNormal) { IsiOpenEnrollment(nvoTemperature::global_index); } else if (isiState == isiPending || isiState == isiApprovedHost) { IsiCreateEnrollment(nvoTemperature::global_index); } ServicePinActivation = 0; } } // MyCsmoData defines the connections details for the automatic // ISI network variable c
Digital Actuator Example The following example application adds ISI support to the previous digital actuator example. The network variable input 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. #pragma enable_sd_nv_names #pragma num_alias_table_entries 2 #include
// 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 }
} // Print the network variable value when an nviSwitch update // is received when(nv_update_occurs(nviSwitch)) { PrintConsole(nviSwitch.
Chapter 6, How Devices Communicate Using Application Messages, of the Neuron C Programmer’s Guide. Feedback Network Variable Connections A typical network variable connection uses one output network variable that provides sensor data, and one input network variable that receives the sensor reading. The connections may use the acknowledged messaging service, and rely on the ANSI/EIA/CEA-709.1 (EN14908-1) protocol to ensure delivery of the related data.
Feedback loops allow for tied control; the lamp can for example sense the light level and provide the feedback signal based on real measurement (rather than assumption). Simple feedback loops contain a single source and a single destination. Creating the feedback connection is straight-forward, as shown in Figure 4.5. Figure 4.
To achieve the same level of transport control in a star-shaped feedback connection, the initiator needs to know the number of expected feedback network variable updates. The initiator device might be able to determine that number dynamically by inspecting the appropriate system tables, but this information is not always available. If the star-shaped feedback connection is made using the acknowledged service and group addressing, the group’s member count is not known to the device by default.
with the eeprom storage class don’t get initialized during reset, but only with a new application image. The following code fragment illustrates this approach: eeprom boolean FirstStart = TRUE; when(reset) { if (FirstStart) { // do whatever needs doing in this special case … // reset the FirstStart flag: FirstStart = FALSE; } } Reset Processing When a device is reset while being configured, the application executes the when(reset) task.
5 Debugging a Neuron C Application This chapter describes how to use the boards and accessories included with the Mini EVK, or additional tools such as the LonMaker Integration Tool or NodeBuilder Development Tool, to debug a Neuron C application.
Debugging a Neuron C Application You can use the boards and accessories included with the Mini EVK to debug a Neuron C application, or you can use additional tools such as the LonMaker Integration Tool or NodeBuilder Development Tool for more efficient and productive debugging. The following sections describe some of the methods you can use to debug your Neuron C applications. The first section describes how you can debug with the boards and accessories included with the Mini EVK.
void PrintConsole(const char *message) { if (strlen(message) <= 100) { io_out(ioSerialOut, message, (unsigned) strlen(message)); } else { io_out(ioSerialOut, errorString, (unsigned) strlen(errorString)); } } // Repeat every 50 milliseconds mtimer repeating scanTimer = 50; // Read the buttons when the timer expires when(timer_expires(scanTimer)) { boolean button; static boolean lastButton; button = GetButton(); if (button != lastButton) { lastButton = button; PrintConsole(button ? "On\n\r" : "Off\n\r"); } }
Figure 5.1 LonMaker Browser The LonMaker Device Manager allows you to control the state of your device and its functional blocks. You can use the device manager to reset your device, put your device online or offline, and test network communication with your device. You can also use the Manage dialog to enable or disable individual functional blocks on your device, and to invoke the self-test function of any of your functional blocks that support self-test. Figure 5.
Figure 5.2 LonMaker Device Manager The LonMaker tool allows you to connect network variables on your devices, and then monitor those connections on the same page that you use to create the connections. Figure 5.3 shows an example LonMaker drawing showing an MGSwitch device connected to an MGDemo device, with connection monitoring enabled to show the current value of the switch and the current output of the temperature sensor.
Figure 5.3 LonMaker Drawing with Connection Monitoring You cannot simultaneously use the same network interface with both the LonMaker tool and the Mini Application. See Using the Mini Application with the LonMaker Tool section later in this chapter for information on using the LonMaker tool with the Mini Application. Debugging with the NodeBuilder Development Tool You can use the NodeBuilder Development Tool to develop and debug Neuron C applications.
Figure 5.4 NodeBuilder Debugger You cannot simultaneously use the same network interface with both the LonMaker tool that is included with the NodeBuilder tool and the Mini Application. See Using the Mini Application with the LonMaker Tool later in this chapter for information on using the LonMaker tool with the Mini Application, or see Using the Mini Application With the NodeBuilder Tool for more information on using the NodeBuilder tool with the Mini Application.
Using the Mini Application with the LonMaker Tool To switch from using the Mini Application on a network interface to the LonMaker tool with the same network interface, follow these steps: 1. Close the Mini Application. This closes the network interface connection from the Mini Application. 2.
Figure 5.5 New Device Template Wizard With these settings, you can use the same device template file for both build processes. Possible conflicts resulting from the sharing of the same NodeBuilder device template file can be resolved by viewing and editing the device template preferences in the NodeBuilder tool.
Mini EVK User’s Guide 79
Appendix A Troubleshooting This appendix describes how to resolve problems that may occur while you are using the Mini EVK.
1. I cannot compile the MGKeyboard application. When I try to compile the application, the "Typename 'UCPTfrequency' not found in Device Resource Files; 'SNVT*', 'SCPT*', 'UNVT*', 'UCPT*' are reserved [NCC#389]" error is reported. • For a TP/FT-10 channel, set the application’s program ID to 9F:FF:FF:05:00:05:04:xx. • For a PL-20N (power line PL-20 Smart Transceiver with CENELEC protocol disabled) target channel type, set the application’s program ID to 9F:FF:FF:05:00:05:11:xx.
Use a TP/FT-10 channel for most of the application development and debugging. When doing so, you must make sure to include use of the targeted power line channel in your testing, as timing and latencies will vary from those observed in the faster development channel. 6. What can I do to improve application load-times? You can reduce the application’s size and have faster downloads, but you won’t be downloading the same application anymore. Another solution is to avoid downloads altogether.
using an I/O button, press and hold the SW1 – SW4 I/O button on the evaluation board running the MGDemo application when accepting or confirming an connection, then press and release the related SW5 – SW8 Connect button on the evaluation board being added to the connection, and then release the original I/O button again.
Appendix B Monitoring & Control Application Overview This appendix describes the structure of the Monitoring & Control C# Example Application, the class interactions, and the different classes it contains.
Monitoring & Control C# Example The Monitoring & Control Example Application is a C# application that monitors ISI messages and uses the OpenLDV API to monitor and control network variables on devices running the MGDemo example. This chapter describes the structure of the Monitoring & Control C# example. The Monitoring & Control Example Application is a Windows application written in Microsoft Visual C# .NET 2003. It requires Microsoft .NET Framework 1.1 to run.
Figure B.
User Interface and Application Specific Implementation This section describes the classes, files, and dialogs that make up the Monitoring & Control Example Application’s user interface. Main User Interface Window The Monitoring & Control Example Application provides a main dialog-based user interface. The MonitorControlMain class contains the implementation of the main user interface window.
main user interface window. The IsiInfoForm class contains the implementation of the ISI Information window. Change Subnet/Node ID Dialog You can change the Subnet/Node ID of the network interface that is currently used by the Monitoring & Control Example Application with the Change Subnet/Node ID dialog. You can access this dialog by clicking Change Subnet/Node ID on the ISI Information window. The ChangeSNForm class contains the implementation of the Change Subnet/Node ID dialog.
(domain resource usage message) that helps detect duplicate subnet/node IDs. When the Monitoring & Control Example Application receives the DRUM, it evaluates the subnet/node ID contained in the message. In the event that the collision of subnet/node ID is detected, the example application reallocates a new subnet/node ID and broadcast the new assigned subnet/node ID using the DRUM. The IsiConfig class contains the implementation of the ISI configuration.
OpenLDV Adapter This section describes the classes and files of the Monitoring & Control Example Application that invoke the OpenLDV API. Operator Class The Operator class is derived from the Dispatcher class. It completes the dispatching of uplink messages, and processes complex operations messages. It also overrides some of the virtual methods to stop uplink data from propagating into the client application.
AppBuffer / ISIAppBuffer The AppBuffer.cs and ISIAppBuffer implementation files contain the collection of conversion classes, which together form the application message buffer structure and support conversion between the unmanaged OpenLDV API and the managed Microsoft .NET environment. The explicit conversion classes are required to handle most issues related to AppBuffer structures, as Microsoft .NET has no concepts of bit fields, which are used by the OpenLDV interface and API. LDV32.DLL The ldv32.
www.echelon.