Mini FX User’s Guide ® 078-0398-01A
Echelon, LON, LONWORKS, Neuron, 3120, 3150, Digital Home, i.LON, LNS, LonMaker, LONMARK, LonPoint, LonTalk, NodeBuilder, ShortStack, and the Echelon logo are trademarks of Echelon Corporation registered in the United States and other countries. FTXL, LonScanner, LonSupport, OpenLDV, and LNS Powered by Echelon are trademarks of Echelon Corporation. Other brand and product names are trademarks or registered trademarks of their respective holders.
Table of Contents Preface ..................................................................................................vii Purpose ........................................................................................................viii Audience ......................................................................................................viii Hardware Requirements ............................................................................viii Content ........................................
Hardware Templates............................................................................. 21 Neuron C ................................................................................................ 21 Device Templates................................................................................... 21 Device Interface Files............................................................................ 22 Resource Files ....................................................................................
I/O Examples Toolkit ...................................................................... 80 Creating Example Device Applications................................................ 84 Digital Sensor and Actuator Examples ......................................... 85 Simple Digital Sensor............................................................... 85 Simple Digital Actuator ........................................................... 86 Advanced Digital Actuator...............................................
vi Preface
Preface The Mini FX Development Kit is a hardware and software platform for evaluating the LONWORKS® 2.0 platform and developing simple LONWORKS devices. The Mini kit lets you build Neuron® C applications and download them to LONWORKS devices, and test LONWORKS devices.
Purpose This document describes how to use the Mini FX Evaluation Kit to develop and build simple Neuron C device applications, download the device applications to LONWORKS devices, and test the LONWORKS devices. Audience This guide is intended for device and system designers with an understanding of control networks. Hardware Requirements Requirements for computers running the Mini kit are listed below: • Microsoft® Windows Vista® or Microsoft Windows® XP.
PCLTA-20, or PCLTA-21 network interfaces; and the SLTA-10 Serial LonTalk Adapter. o Compatible remote network interfaces include the i.LON® SmartServer, i.LON 100 e3 plus Internet Server, or i.LON 600 LONWORKS-IP Server. o Compatible IP-852 routers include the i.LON SmartServer with IP-852 routing, i.LON 100 e3 plus Internet Server with IP-852 routing, or an i.LON 600 LONWORKS-IP Server.
FT 5000 EVB Hardware Guide Describes how to connect the FT 5000 EVBs, and describes the Neuron core, I/O devices, service pin and reset buttons and LEDs, and jumper settings on the FT 5000 EVB hardware. Two FT 5000 EVBs are included with the Mini FX/FT Evaluation Kit. Introduction to the LONWORKS® Platform Provides a high-level introduction to LONWORKS networks and the tools and components that are used for developing, installing, operating, and maintaining them.
NodeBuilder® Resource Editor User’s Guide Describes how to use the NodeBuilder Resource Editor to create and edit resource file sets and resources such as functional profiles, network variable types, and configuration property types. PL 3120® / PL 3150® / PL 3170™ Smart Transceiver Data Book Provides detailed technical specifications on the electrical interfaces, mechanical interfaces, and operating environment characteristics for the PL 3120, PL 3150, and PL 3170 Power Line Smart Transceivers.
xii Region Languages Supported Contact Information Japan Japanese Echelon Japan Holland Hills Mori Tower, 18F 5-11.2 Toranomon, Minato-ku Tokyo 105-0001 Japan Phone: +81.3-5733-3320 Fax: +81.3-5733-3321 lonsupport@echelon.co.jp China Chinese English Echelon Greater China Rm. 1007-1008, IBM Tower Pacific Century Place 2A Gong Ti Bei Lu Chaoyang District Beijing 100027, China Phone: +86-10-6539-3750 Fax: +86-10-6539-3754 lonsupport@echelon.com.cn Other Regions English Japanese Phone: +1.
1 Introduction This chapter introduces the Mini FX Evaluation Kit. It lists the new features in the Mini kit, and it summarizes the components included with the Mini kit. It describes how to upgrade your device development environment with the NodeBuilder tool, LonMaker tool, and an activated LonScanner tool. It provides an overview of device development with the Mini kit and LONWORKS networks.
Introduction to the Mini FX Evaluation Kit The Mini FX Evaluation Kit is a hardware and software platform for evaluating the LONWORKS® 2.0 platform and developing LONWORKS devices based on the Series 5000 and 3100 Neuron Chips and Smart Transceivers. The Mini kit lets you build Neuron C applications and download them to LONWORKS devices, and test LONWORKS devices.
• Backwards compatibility for device applications. Improved Memory Architecture The Series 5000 chips have a new memory architecture that speeds up the CPU operation and lowers development and device costs. The Series 5000 chips have internal on-chip memory that includes 16 KB of ROM to store the Neuron firmware image and 64 KB of RAM (44 KB is available for application code and data).
Figure 1.1 Series 5000 Chip Architecture Faster System Clock The Series 5000 chips support an internal system clock speed of up to 80 MHz (using an external 10 MHz crystal). This results in application processing power that equals a hypothetical FT 3150 Smart Transceiver operating at an external clock speed of 160MHz. You can adjust the internal system clock speed from 5 MHz to 80 MHz through the device’s hardware template.
routines and your device application. At lower system clock rates, these interrupts run in the same application processor (APP) as the device application. Additional I/O Model Support The Series 5000 chips include hardware support for the Serial Peripheral Interface (SPI) and Serial Communication Interface (SCI) serial I/O models, which provide increased performance for devices that use these interfaces.
The Neuron C Version 2.2 language includes new keywords such as interrupt, __lock, stretchedtriac, __slow, __fast, and __parity. Some of these keywords use a double underscore prefix to avoid any likely naming collisions within existing device applications. FT 5000 EVB Evaluation Board The FT 5000 EVB is a complete Series 5000 LONWORKS device that you can use to evaluate the LONWORKS 2.0 platform and create LONWORKS devices.
The PL 3150 EVB is a complete LONWORKS device that includes a PL 3150 Smart Transceiver operating at 10MHz external clock (5MHz system clock speed), 64KB of off-chip flash memory, and 2KB of on-chip RAM. You can attach a Mini Gizmo I/O Board to the PL 3150/PL 3170 EVBs to test your device applications and test the example applications included with the Mini FX/PL Evaluation Kit. Neuron C Version 2.2 Enhancements The new features in the Neuron C Version 2.
You can enable and disable specific warnings using the new #pragma enable_warning and #pragma disable_warning compiler directives, and you can use the new #error and #warning compiler directives to manage conditional compilation, raising user-defined warning or error messages as necessary. You can use the new #pragma library directive to indicate any required library. You can use enhanced buffer control directives for statements of minimum or final requirements.
LonScanner Protocol Analyzer CD (Demo Edition) 5 5 U10 or U20 USB Network Interface 5 5 The following sections describe each of the components. Mini FX CD The Mini FX CD contains the software required to build and download Neuron C applications for your LONWORKS devices, and it includes Neuron C example applications that you can run on your development platform and use to further learn how to develop your own device applications.
Development Platforms The Mini FX/FT Evaluation Kit includes two FT 5000 EVBs. The Mini FX/PL Evaluation Kit includes one PL 3150 EVB and one PL 3170 EVB. The following sections describe these development platforms. FT 5000 EVB Evaluation Board The FT 5000 EVB is a complete Series 5000 LONWORKS device that you can use to evaluate the LONWORKS 2.0 platform and create LONWORKS devices.
supplies included with the PL 3150 and 3170 EVBs pass the network signals directly into the AC power lines over the same two wires that power the evaluation boards. With the PL 3150 and 3170 EVBs, you can begin building a power line control network by simply plugging the evaluation boards into an electrical outlet. You can also attach the included Mini Gizmo I/O Boards to the PL 3150/PL 3170 EVBs to test your device applications and run the example applications included with the Mini FX/PL Evaluation Kit.
also use it with other network interfaces including an IP-852 (ISO/IEC 14908-4) interface as described in the LonScanner Protocol Analyzer User’s Guide. The LonScanner tool included with the Mini kit will run in demo mode until you purchase a key and activate it. When operating in demo mode, the protocol analyzer does not display every captured packet and displays only the first 20 packets of a saved or imported log file.
• Debugger. Debug your application with a source-level view of your application code as it executes. The debugger lets you control and observe the behavior of your device application over a LONWORKS channel. The debugger lets you set breakpoints, monitor network variables, halt the application, step through the application, view the call stack, and peek and poke memory. You can make changes to the code as you debug a single device or debug multiple devices simultaneously. • Project Manager.
Feature Mini FX Evaluation Kit LonScanner Protocol Analyzer (Demo Edition) NodeBuilder FX Tool 5 LonScanner Protocol Analyzer (LNS Turbo Edition) 5 LNS Plug-in Framework Kit 5 a The NodeBuilder FX tool supports up to 254 static network variables and 127 network variable aliases for Neuron-hosted devices that use version 16 firmware or greater (for example, the Series 5000 chips, which use version 18 firmware).
The Data Point shape provides similar functionally as the LonMaker Browser, but directly in your LonMaker drawing. The Data Point shape is a LonMaker Basic Shape that you can add to your LonMaker drawing to monitor and control individual network variables and configuration properties in your device. You can use a Data Point shape to monitor the value of any input or output network variable, configuration property, or functional block state (enabled or in override).
communications processor, or it may handle both application processing and communications processing on the host processor. The Mini kit supports some of the common tasks occurring in the creation of host-based devices; however, an additional host-based device development tool, such as the ShortStack® FX or the FTXL™ Developer’s Kit combined with a host development tool, is required. Each device includes one or more processors that implement the ISO/IEC 14908-1 Control Network Protocol (CNP).
Applications Every LONWORKS device contains an application that defines the device’s behavior. The application defines the inputs and outputs of the device. The inputs to a device can include information sent on LONWORKS channels from other devices, as well as information from the device hardware (for example, the temperature from a temperature sensing device).
Field Description manufacturer ID, you can find your ID in the list of manufacturer IDs at www.lonmark.org/spid. The most current list at the time of release of the Mini kit is also included with the Mini kit software. • Temporary manufacturer IDs are available at no charge to anyone on request by filling out a simple form at www.lonmark.org/mid. Device Class (C) A 4 hex-digit value identifying the primary function of the device.
an input network variable that was of the switch type, while an application on a dimmer-switch device could have an output network variable of the same type. A network management tool such as the LonMaker Integration Tool could be used to connect these two devices, allowing the switch to control the lighting device, as shown in Figure 1.4: Figure 1.4 Network Variable Connection A single network variable may be connected to multiple network variables of the same type but opposite direction. Figure 1.
Connections may be thought of as virtual wires. For example, the dimmer-switch device in the dimmer-switch-light example could be replaced with an occupancy sensor, without making any changes to the lighting device. You can declare a maximum of 32 network variables in a Neuron C application to be compiled with the Mini kit. The NodeBuilder FX Development Tool supports up to 254 network variables.
Figure 1.6 Functional Profile When a functional block is created from a functional profile, the application designer can determine which of the optional configuration properties and network variables to implement. With some functional profiles, you can control certain aspects of the implementation such as the network variable type, or the size of a configuration property array. Hardware Templates A hardware template is a file with a .NbHwt extension that defines the hardware configuration for a device.
Mini kit will upgrade this device template as necessary, but it will not delete or manage it. If you build the application with the NodeBuilder tool, the NodeBuilder tool automatically produces an LNS device template and passes it to the LonMaker tool and other network tools. The LNS device template defines the external device interface, and it is used by the LonMaker tool and other network tools to configure and bind the device.
2 Installing the Mini FX Evaluation Kit This chapter describes how to get started with your Mini kit, including how to install the Mini FX software and connect the Mini FX hardware.
Installing the Mini FX Evaluation Kit To install your Mini FX Evaluation Kit, follow these steps: 1. Verify that you have a manufacturer ID. A manufacturer ID is required for many Mini kit functions. Standard manufacturer IDs are assigned to manufacturers when they join LONMARK International, and are also published by LONMARK International so that the device manufacturer of a LONMARK certified device is easily identified.
2. If the Mini FX setup application does not launch immediately, click Start on the Windows taskbar and then and click Run. Browse to the Setup application on the Mini FX CD and click Open. The Echelon Mini FX Evaluation Kit main menu opens. Figure 2.1 Mini FX Evaluation Kit Main Menu 3. Click Install Products. The Install Products dialog opens. Figure 2.
4. Click Microsoft .NET Framework 3.5 SP1 to install Microsoft .NET Framework 3.5 SP1 and then follow the on-screen instructions. Microsoft .NET Framework 3.5 SP1 is required to run the Mini FX Application. 5. After Microsoft .NET Framework 3.5 SP1is installed, click the Echelon Mini FX Evaluation Kit button in the taskbar to return to the Mini FX installer, and then click Mini FX Evaluation Kit in the Install Products dialog. The Welcome window of the Mini FX software installer opens. Figure 2.
Figure 2.4 Mini FX Evaluation Kit Installer—License Agreement 7. Read the license agreement (see Appendix C, Mini FX Software License Agreement, for a printed version of this license agreement). If you agree with the terms, click Accept the Terms and then click Next. The Customer Information window appears. Figure 2.5 Mini FX Evaluation Kit Installer—Customer Information 8. Enter the Mini FX serial number on the back of Mini FX Evaluation Kit CD in the Serial Number box.
Figure 2.6 Mini FX Evaluation Kit Installer—Setup Type 11. Select the type of installation to be performed. Select Complete to install all the Mini kit features or select Custom to choose whether to install the FT 5000 EVB examples, Mini EVB examples, both sets of examples, or neither on your computer. Click Next. The Ready to Install window appears. Figure 2.7 Mini FX Evaluation Kit Installer—Ready to Install 12. Click Install to begin the Mini FX software installation.
they are installed, but have a lower version): ISI Developer’s Kit 3.02, OpenLDV 3.40, NodeBuilder Resource Editor 4.0, and LONMARK Resource Files 13.00. 13. After the Mini kit software has been installed, a window appears stating that the installation has been completed successfully. Figure 2.8 Mini FX Evaluation Kit Installer—Completed 14. Click Finish. If a window appears prompting you to reboot your computer now or later, click Yes to reboot your computer now. 15.
Connecting the Mini FX/FT Hardware To connect the Mini FX/FT hardware, follow these steps: 1. Unpack the equipment from the shipping carton. Note: The FT 5000 EVBs are shipped in protective anti-static packaging. When assembling the FT 5000 EVBs, the boards must not be subjected to high electrostatic potentials. Avoid touching the component pins, or any other metallic equipment on the evaluation boards. 2. Verify that all of the following hardware and software items listed in Table 2.1 are present. Table 2.
Figure 2.9 FT 5000 EVB Power Supply Connection 4. Connect the orange network connector on each FT 5000 EVB to the included network cable. Figure 2.10 FT 5000 EVB Network Connection 5. Use the included U10 USB Network Interface to attach the computer running the Mini FX Application to the TP/FT-10 channel. To do this, connect the black network connector on the network cable to the U10 USB Network Interface, and then plug the U10 USB Network Interface into an available USB port on your computer.
Figure 2.11 USB 10 Network Interface Connection If this is the only LONWORKS interface installed on your computer, it will automatically use the default name LON1, and you can proceed directly to your software application and begin using the interface as LON1. If you have another network interface installed on your computer, you can check the name used by the U10 USB Network Interface in the LONWORKS Interfaces application.
The NcMultiSensorExample application is pre-loaded on the FT 5000 EVBs and runs in Interoperable Self-Installation (ISI) mode by default. You install and connect this example application and the other examples using the LonMaker tool, or using the ISI protocol. See the FT 5000 EVB Examples Guide for more information on using these example applications.
Figure 2.12 PL 3150/PL 3170 EVB Connections 5. After you plug in the power supplies, LED1 will begin flashing, indicating that the PL Evaluation Board has entered CENELEC configuration mode. If LED8 is on, then the CENELEC access protocol is enabled. If LED8 is off, CENELEC is disabled. By default, CENELEC is enabled. You must enable the CENELEC access protocol when operating within one of the CENELEC member states.
protocol. To view this book, click Start, point to Programs, point to Echelon Mini, point to Smart Transceiver Data Books, and then click it. 6.
Note: Echelon power line technology combined with ISI self-installation provides virtual plug and play communication in a single-family home environment. Mini kit users are encouraged to explore the communication capabilities of these evaluation units in a variety of home environments.
3 Mini FX Quick-Start Exercise This chapter demonstrates how to create a LONWORKS device using the Mini kit.
Mini FX Quick-Start Exercise The following quick-start exercise demonstrates how to create a LONWORKS device with the Mini kit. It introduces Mini kit features; familiarizes you with the Mini FX Application user interface; and guides you through all the steps of developing a device with the Mini kit, including creating, writing, compiling and building, and downloading the Neuron C device application.
Save. This creates a new empty Neuron C source file named main.nc in your chosen location, and it opens the file using your computer’s default text editor. 3. Proceed to the next section to write your Neuron C device application in the main.nc file. Step 2: Writing the Device Application When developing the device application, you will typically concentrate on writing the algorithms that implement your device’s functionality.
4. Add the following code that initializes the I/O devices and writes to the LCD when the FT 5000 EVB is reset: void InitializeIO() { io_change_init(ioSwitch1); } void LcdDisplayString(unsigned row, unsigned column, const char* data); when(reset) { InitializeIO(); LcdDisplayString(0,0, LcdDisplayString(1,0, LcdDisplayString(2,0, LcdDisplayString(3,0, "Mini FX QuickStart "); "===================="); "Press SW1 to toggle "); "LED1 "); } 5.
LcdDisplayString(3, 0, “LED1 = “); LcdDisplayString(2, 7, led ? “ON” : “OFF”); LcdDisplayString(3, 7, sw ? “ON” : “OFF”); } 6. Save your main.nc Neuron C source file. 7. Proceed to Step 3: Building the Device Application to compile and build your Neuron C device application. For more information on writing Neuron C code to implement your device’s functionality, see Chapter 5, Developing Device Applications. PL 3150 and PL 3170 Evaluation Boards 1.
// strobe: io_out(ioLedLoad, 0); io_out(ioLedLoad, 1); } //Create global variable to store the previous SW1 button state. boolean switchState; // Create function that sets LED1 when SW1 button is pushed.
application image files used for various memory parts, see Chapter 8 of the NodeBuilder FX User’s Guide. To compile and build, your device application, follow these steps: 1. In the Target Hardware box on the Application tab, select the standard hardware template for your EVB. • If you are using the Mini FX/FT Evaluation Kit, select FT 5000 Evaluation Board.
Note: The current list of manufacturer IDs, device classes, usage values, and channel types are defined in an XML file (spidData.xml) that is available at www.lonmark.org/spid. This file is updated as LONMARK International adds new manufacturer IDs, device classes, usage values, and channel types. 4. Click OK to return to the Mini FX Application. The program ID you specified in the Standard Program ID Calculator dialog appears in the Standard Program Identifier box. 5.
Step 4: Downloading the Device Application You can use the Mini FX Application to download an application image over a LONWORKS network into your development platform. In this step, you will download the application image file that was automatically created when you built the device in the previous section. To download the application image file into your EVB, follow these steps. 1. Click the Device tab. 2.
Figure 3-2 demonstrates that the device application in this quick-start exercise has successfully been downloaded to the EVB. In addition, it displays the properties set in the Device tab to download the device application. Figure 3.2 Downloading the Device Application Step 5: Testing the Device Application You can use the switch and LED I/O devices on your EVB to test your device application, and verify that it is functioning as designed. To test your device application, follow these steps: 1.
4 Using the Mini FX Application This chapter describes how to use the Mini FX Application to build a Neuron C device application and download it into a device. This chapter also describes how to use the Mini FX Application to reset, wink or test a device.
Introduction to the Mini FX Application The Mini FX Application is an easy-to-use program consisting of two tabs: the Application tab and the Device tab. You use the Application tab to create/edit, compile, and build Neuron C device applications, and you use the Device tab to download your device applications. You can use the Application tab to create new Neuron C device applications or edit existing ones. Neuron C (Version 2.
Creating and Opening Neuron C Source Files You can use the Application tab in the Mini FX Application to create a new Neuron C source file or open an existing one. To create/open a Neuron C source file and include library files, follow these steps: 1. Start the Mini FX Application. To do this, click Start on the taskbar, point to Programs, point to the Echelon Mini program folder, and then click Mini FX Application. The Mini FX Application opens with the Application tab selected. Figure 4.
5000 EVB example applications, see the FT 5000 EVB Examples Guide. For more information on the PL 3150/PL 3170 EVB example applications, see the Mini FX/PL Examples Guide. Note: Windows Notepad is typically your default Neuron C source editor. To use a different editor, open the Folder Options in the Windows Control Panel, click the File Types tab, select the NC extension, and then click Change to change the program to be used to open .NC files, and then click Close.
libraries are supplied, varying in features provided and application memory required. For more information on the libraries required by the various Mini FX/PL example applications, see the Mini FX/PL Examples Guide. Selecting the Hardware Template You can use the Application tab in the Mini FX Application to select the hardware template for your device application.
identifies the device application. The program ID may be formatted as a standard or non-standard program ID. When formatted as a standard program ID, the 16 hex digits are organized as six fields that identify the manufacturer, classification, usage, channel type, and model number of the device. To specify the program ID for your device application, follow these steps: 1. Click Calculate in the Standard Program Identifier box. The Standard Program ID Calculator dialog opens. Figure 4.
• If you do not have a standard manufacturer ID, you can request a temporary manufacturer ID by filling out a simple form at www.lonmark.org/mid. 3. In the Category property, select the general purpose or industry of the device. The Category determines the device classes that will be available in Device Class property. Alternatively, you can select one of the following options to determine and organize the device classes shown in the Device Class property: • ALL. Show all the existing device classes.
device class, usage, and channel type. The same hardware may be used for multiple model numbers depending on the program that is loaded into the hardware. The model number within the program ID does not have to conform to your published model number. 8. In the Standard Development Program ID property, identify your device as a standard development/prototype device or as a LONMARK certified device.
10. Click OK to return to the Application tab in the Mini FX Application. The program ID you calculated appears in the Standard Program Identifier box. Building the Application Image File You can use the Application tab in the Mini FX Application to compile your device application and generate a downloadable application image file for it. To do this, follow these steps: 1. Click Build in the Build Application Image box. 2.
2. In the Network Interface box, select the network interface attached to your development computer that is to be used for communication between the Mini FX Application and your EVB, and then click Connect. If you are using the U10 or U20 USB Network Interface included with the Mini kit and you have not installed any other network interfaces on your computer, select LON1. The Status box at the bottom indicates whether the Mini FX Application is connected to a network interface.
Note: The Mini FX Application is an OpenLDV application; therefore, it cannot share a network interface with other LONWORKS applications. This means that when the Mini FX Application is attached to a network interface, network tools such as the LonMaker tool cannot use that network interface at the same time. To make the network interface available to other applications, you must close the Mini FX Application.
Figure 4.4 Service Pin Message Dialog The Neuron ID is a unique 48-bit (12-hex digit) identifier contained in every LONWORKS device. The Mini FX Application uses the Neuron ID to communicate with your selected device. For more information on Neuron IDs, see the Introduction to the LONWORKS Platform document in the Echelon Mini FX program folder. The program ID is a 16-hex-digit number that uniquely identifies the device application.
through the ISI protocol (all self-installed devices in the network are silently registered and added to the Device list). 4. From the list in the Application Image box, select the application image file to be downloaded into the device you selected in step 3. The list includes all the application images you have recently built or added with the Mini FX Application. The last application image file that was built with the Mini FX Application appears in this box by default.
Note: After you load one of the MgDemo, MgSwitch, MgKeyboard or MgLight application image files into a PL 3150/PL 3170EVB, LED1 will begin flashing, indicating that the PL EVB has entered CENELEC configuration mode. If LED8 is on, then the CENELEC EN-50065-1 protocol is currently enabled. If LED8 is off, this CENELEC protocol is currently disabled. The initial setting depends on the hardware template you selected when you loaded the application image into a PL EVB.
o • When you wink a PL EVB when it is running an example application LED1– LED3 on the Mini Gizmo I/O Board turn on and LED4–LED8 blink rapidly for a few seconds, and the TX and RX LEDs on the EVB quickly flash. Test. You can test a device to check its current status.
62 Using the Mini FX Application
5 Developing Device Applications This chapter provides an overview of the Neuron C Version 2.2 programming language. It provides a series of programming examples that demonstrate Neuron C concepts, including input/output, timers, network variables, configuration properties, functional blocks, and Interoperable Self-Installation (ISI).
Introduction to Neuron C Neuron C Version 2.2 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, interrupt-handling, and event-handling extensions to ANSI C, which make it a powerful tool for the development of LONWORKS device applications.
Neuron C also provides a way to organize the network variables and configuration properties in the device into functional blocks. Functional blocks provide 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. Each network variable, configuration property, and functional block is defined by a type definition contained in a resource file.
Timers may be automatically reloading (repeating), or one-shot timers, with a duration ranging from 0.001–65,535 seconds. Neuron C supports programmable hardware timer units through a variety of I/O library functions. These functions provide a resolution up to 1 MHz (1 µs) or better, subject to the selected I/O model, Neuron type, clock speed, and other factors (see the I/O Model Reference for more information).
Neuron C Storage Classes If no class is specified for a declaration at file scope, the data or function is global. File scope is that part of a Neuron C program that is not contained within a function, a when-task, or an interrupt-task. Global data (including all data declared with the static keyword) is present throughout the entire execution of the program, starting from the point where the symbol was declared.
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.
Declaration Example Configuration Properties SCPTdefOutput cp_family cpDefaultOut; Functional Blocks fblock SFPTnodeObject { … } myNode; Getting Started with Neuron C This section provides a series of Neuron C examples that demonstrate how to use Neuron C to perform I/O functions. These programming examples are designed to work with both the FT 5000 EVB and the PL 3150/PL 3170 EVB, with minor functional differences based on the hardware and system resources on the boards.
Table 5.
chapter, and the jumper configuration discusses earlier in this chapter, use an EIA232 connection. • You can connect your PL 3150 EVB to your development computer via an EIA 232 interface. For more information on connecting the serial interface on a PL 3150 EVB, see the Mini FX/PL Examples Guide. If you are using the Mini FX/FT Evaluation Kit, you can also use the LCDs on the FT 5000 EVBs to display debug output, application data, and usage information.
Document Title Description 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.
IO_9 input bit ioSwitch1; void example() { if ((boolean)io_in(ioSwitch1)) { … } } The Neuron C language implements a largely event-driven programming model. This means that instead of constantly polling all I/O for new data, your device application only needs to respond to changes. The following example initializes this system during reset processing, and calls an OnButtonPressed() event handler whenever an activated button is detected.
and a bit output model for the latch pulse. To read any of these buttons, all eight buttons must be read from the shift register.
#ifdef USE_5000EVB IO_9 input bit ioSwitch1; // // when(io_changes…) executes whenever the button is pressed // when(io_changes(ioSwitch1) to 0) { OnButtonPressed(); } #ifdef USE_MINIGIZMO IO_4 input bitshift numbits(8) clockedge(-) ioButtons; IO_6 output bit ioButtonLoad = 1; boolean GetButton(void) { unsigned debounce; unsigned data; data = 0xFF; for (debounce = 0; debounce < 3; ++debounce) { // Strobe: io_out(ioButtonLoad, 0); io_out(ioButtonLoad, 1); // Sample data and debounce: data &= (unsigned)io
FT 5000 EVB The FT 5000 EVB includes two LEDs: LED1 and LED2. LED1 and LED2 are connected to pins I/O 2 and I/O 3, respectively. You can drive the state of these LEDs by simply declaring a one bit output model for each LED, and assigning the desired output value with the io_out() Neuron C library function: IO_2 output bit ioLed1 = 1; IO_3 output bit ioLed2 = 1; For use with the examples provided in this chapter, a SetLeds() function takes two arguments, the logical on/off state for each LED.
#ifdef USE_5000EVB IO_2 output bit ioLed1 = 1; IO_3 output bit ioLed2 = 1; #else #ifdef USE_MINIGIZMO IO_2 output bitshift numbits(8) ioLeds; IO_1 output bit ioLedLoad = 1; #endif // mini gizmo #endif // 5000 evb void SetLeds(boolean led1, boolean led2) { #ifdef USE_5000EVB io_out(ioLed1, !led1); io_out(ioLed2, !led2); #else #ifdef USE_MINIGIZMO unsigned data; // Compute the data byte for the shift register: data = led1 ? 0x01 : 0x00; data |= led2 ? 0x02 : 0x00; // Push inverted data into shift register: io
current.raw[0] = (unsigned)touch_byte(ioTemperatureSensor, 0xFFu); if (touch_reset(ioTemperatureSensor)) { // The value currently held in ‘current’ is the raw DS18S20 // data, in Celsius, at a resolution of 0.5 degrees. // SNVT_temp_p, however, provides a resolution of 0.01 in // a fixed-point implementation. // Correct the raw reading by factor 50 thus: current.
LCD Display The LCD display included with the FT 5000 EVB may be used to display status or other application data in an easy-to-read fashion. In addition, it can be used to debug and diagnose applications. The display is connected to the Smart Transceiver through an I2C interface to the I/O 0 and I/O 1 pins. The functions shown in the following example use the i2c input/output model. For applications built in debug mode, the LcdDisplayString() function automatically forwards the data to the serial output.
// Set the cursor position static const unsigned lcdRowAddress[4] = {0x00, 0x40, 0x14, 0x54}; SendLcdCommand(LCD_COMMAND_SETCURSOR, lcdRowAddress[row]+column, 2); // Send the data (void)io_out(ioIIC, data, I2C_ADDRESS_LCD, (unsigned)strlen(data)); # ifdef _DEBUG // in a debug build, forward the same data to the serial port: watchdog_update(); SerialOutput(data); # endif // _debug #else // Use mini gizmo: // Always send data to serial port (in lieu of a local display) SerialOutput(data); #endif // mini gizm
// levels, i.e. TRUE for "on". // The driver function translates the logical levels as necessary.
// when(timer_expires(buttonTimer)) { static boolean previousButton = TRUE; boolean currentButton; currentButton = GetButton(); if (currentButton && !previousButton) { OnButtonPressed(); } previousButton = currentButton; } #else #ifdef USE_5000EVB IO_9 input bit ioSwitch1; // // when(io_changes…) executes whenever the switch // when(io_changes(ioSwitch1) to 0) { OnButtonPressed(); } #endif #endif // 5000 evb // mini gizmo // // Driver to support a 1-Wire Dallas DS18S20 digital thermometer device.
} else { current.value = 32767l; } } return current.value; } // // Driver to support simple serial output. The SerialOutput() function // sends a zero-terminated string (without the termination byte) to the // serial output, using the SCI input/output model. The function auto// matically appends a "\r\n" line termination. // The SCI model is not available on all target chips, as it requires // and uses the on-chip UART. Consider using the serial output model on // IO 10 as a replacement in this case.
{ #ifndef USE_MINIGIZMO SendLcdCommand(LCD_COMMAND_ON, 0, 1); SendLcdCommand(LCD_COMMAND_BRIGHTNESS, 1, 2); SendLcdCommand(LCD_COMMAND_CLEARSCREEN, 0, 1); #else // use mini gizmo: SerialOutput("\r\n---Reset"); #endif // mini gizmo } void LcdDisplayString(unsigned row, unsigned column, const char* data) { #ifndef USE_MINIGIZMO // Set the cursor position: static const unsigned lcdRowAddress[4] = {0x00, 0x40, 0x14, 0x54}; SendLcdCommand(LCD_COMMAND_SETCURSOR, lcdRowAddress[row]+column, 2); // Send the data (vo
• The example device applications presented in this section are not considered interoperable mainly because they do not include a Node Object functional block. For examples of interoperable device applications that are more complex, see the FT 5000 EVB examples or Mini FX/PL examples included with the Mini kit.
// zero after reset. network output SNVT_switch nvoSwitch; // // OnButtonPressed() is called whenever the button becomes active. // void OnButtonPressed() { // toggle the reported switch status: nvoSwitch.state ^= 1; nvoSwitch.value = nvoSwitch.
SFPTopenLoopActuator, where each functional block encapsulates the network variable and configuration property for each lamp. Following the declaration of the input network variables and configuration properties, the fblock construct defines the functional block, and it describes how locally implemented network variables and configuration properties map to the definitions in the SFPTopenLoopActuator functional profile instantiated by the functional block.
Advanced Digital Sensor Example The advanced digital sensor example expands the previous simple digital sensor and advanced digital actuator examples by adding an implementation of the SFPTopenLoopSensor functional profile to the first digital sensor example, and by adding configuration property processing to the application algorithm.
// and make sure the timer is stopped: // nvoSwitch.state ^= 1; autoOffTimer = 0; } // Finally, set the switch value according to its state: nvoSwitch.value = nvoSwitch.state ? 200u : 0; } // // when(timer_expires(....)) executes when the timer specified in // the event condition has expired. In this example, this happens // when the auto-off timer expires // when(timer_expires(autoOffTimer)) { // Shut down the light nvoSwitch.state = nvoSwitch.
#include #include #include "io.
Thermostat(); } when(timer_expires(sampleTimer)) { Thermostat(); } when(nv_update_occurs(nviSetpoint)) { Thermostat(); } void OnButtonPressed(void) { // do nothing in this application } The Thermostat() function then implements the behavior of the functional block: // // The Thermostat function samples the current temperature, // computes the control values for heater and cooler, and // updates the status network variable as it goes along.
Display(3,0, "Setpoint: 0.
decide whether to start the ISI engine at reset time, but it does not have to make the same decision repeatedly. The remainder of the application can make calls into the ISI API regardless of the ISI engine’s running state. If the ISI engine is not currently running, the calls into the ISI API are ignored (or yield a benign response). The ISI engine itself has no knowledge of the application it serves.
// uses the PL 3170 Smart Transceiver, and use IsiCompactS.lib for // devices using an FT 3120 or PL 3120 Smart Transceiver. // #include #pragma library "$STD$\IsiFull.lib" // // Reset Processing // // The when(reset) task executes when the device resets. To control // the ISI engine start-up, or to prevent the ISI engine from starting, // reset processing contains the following logic: // a) If this is the first reset with a new application image, the reset // code sets nciNetConfig to CFG_LOCAL.
// TODO: process other application messages here (if any) ; } } The second part of this segment provides visual feedback about the ISI enrollment status to the user (through LED1 in this example).
ISI_DEFAULT_GROUP, isiDirectionVarious, 1, 0xFF, 95u, 0, { 0, 0, isiScopeStandard, {0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 1 } }; void IsiCreateCsmo(unsigned Assembly, IsiCsmoData* pCsmoData) { memcpy(pCsmoData, &myCsmo, sizeof(IsiCsmoData)); #pragma ignore_notused Assembly } // // When ISI receives an open enrollment, it inquires with the // application whether this is an eligible enrollment.
Appendix A Glossary This appendix provides definitions for many terms commonly used with Mini FX device development.
Application Device A LONWORKS device that runs an ISO/IEC 14908-1 application (OSI Layer 7). The application may run on a Neuron Chip or Smart Transceiver, in which case the device is called a “Neuron hosted” device.
Commissioning The process in which the LonMaker tool or other network management tool downloads network and application configuration data into a physical device. For devices whose application programs are not contained in ROM, the network management tool also downloads the application program into non-volatile RAM in the device. Devices are usually either commissioned and tested one at a time, or commissioned and then brought online and tested incrementally.
Download An installation process in which data, such as the application program, network configuration, and/or application configuration, is transferred over the network into a device. Free Topology A connection scheme for a communication channel that eases traditional transmission line restrictions of trunks and drops of specified lengths and at specified distances, and terminations at both ends.
User-defined functional profiles can be created if no appropriate standard profiles are available. Hardware Template A file with a .NbHwt extension that defines the hardware configuration for a target device. It specifies hardware attributes including platform, transceiver type, Neuron Chip or Smart Transceiver model, clock speed, system image, and memory configuration. Several hardware templates are included with the Mini kit. You can use these or create your own.
vendors can work together to install, maintain, monitor, and control LONWORKS networks. The LNS architecture consists of the following elements: 1. LNS client applications, which can be used to develop, monitor and control LONWORKS networks. 2. The LNS Object Server ActiveX Control, which is a language-independent programming interface for LNS client applications to access the LONWORKS network. 3. The LNS Server, which manages the network and maintains a database containing the network configuration.
LONWORKS Network A network of intelligent devices (such as sensors, actuators, and controllers) that communicate with each other using a common protocol over one or more communications channels. LONWORKS Technology The technology that allows for the creation of open, interoperable control networks that communicate with the ISO/IEC 14908-1 Control Network Protocol. LONWORKS technology consists of the tools and components required to build intelligent device and to install them in control networks.
can be a standard configuration property type (SCPT) or a user-defined configuration property type (UCPT) Neuron 5000 Processor Echelon’s next-generation Neuron chip designed for the LONWORKS 2.0 platform. The Neuron 5000 processor is faster, smaller, and cheaper that previous-generation Neuron chips. The Neuron 5000 processor includes a fourth processor for interrupt service routine (ISR) processing.
Neuron Firmware A complete operating system including an implementation of the ISO/IEC 14908-1 protocol used by a Neuron Chip or Smart Transceiver. The Neuron firmware is a program that is inserted into memory of a Neuron Chip or Smart Transceiver. Neuron ID A 48-bit number assigned to each Neuron core at manufacture time. Each Neuron core has a unique Neuron ID, making it like a serial number.
variables or configuration properties specified by the functional profile that the functional block is instantiating. PCC-10 A type II PC (formerly PCMCIA) card network interface that includes an integral TP/FT-10 transceiver. Other transceiver types can be connected to the PCC-10 via external transceiver “pods”. PCLTA-20/21 A ½ size ISA card network interface.
The SLTA-10 network interface is supported, but not recommended unless dial-up operation through a modem and a serial connection is required. You should use a PCC-10 or U10/20 USB network interface instead. For accessing remote networks, you can use an RNI such as the i.LON SmartServer, i.LON 100 e3 plus Internet Server, or i.LON 600 LONWORKS-IP Server. Self-Installed Network A network that has network addresses and connections created without the use of a network management tool.
durations of time, in seconds. The SCPTmaxSentTime standard configuration property type references SNVT_time_sec, but adds semantics by clarifying that this configuration property defines the maximum period of time between consecutive transmissions of the current value. See types.lonmark.org for a current list and documentation. Standard Functional Profile A standard set of functional profiles defined by LONMARK International. See types.lonmark.org for a current list and documentation.
Appendix B Creating and Editing Hardware Templates This appendix explains how to edit standard hardware templates with the Mini FX Application.
Using Hardware Templates You can create new custom hardware templates and then configure them with the Hardware Template Editor in the Mini FX Application. A hardware template is a file with a .NbHwt extension that defines the hardware configuration for a target device. It specifies hardware attributes including platform, transceiver type, Neuron Chip or Smart Transceiver model, clock speed, system image, and memory configuration.
Creating Custom Hardware Templates You can create a new custom hardware template from a copy of a Standard hardware template, or you can create and configure a custom hardware template from scratch using the Hardware Template Editor. To create a new custom hardware template from a copy of a Standard hardware template, follow these steps: 1. Browse to the LONWORKS\NodeBuilder\Templates\Hardware\Standard folder. 2. Copy the Standard hardware template to be used as the source.
Figure B-2 Default Hardware Properties You can set the following properties on the Hardware tab: Hardware Template Name 112 Enter the name of the hardware template. By default, new hardware templates are named Custom 1, Custom 2, and so on. The hardware template name may be any valid Windows file name. The name can contain up to 210 characters, including spaces. The name cannot contain the following characters: \ / : * ? “ < > |.
Platform A platform is a category of hardware implementations. Most hardware templates, including standard and user-defined hardware templates, are implemented using the Custom platform. The Custom platform is suitable for all user-defined hardware. If you are building a device application to be downloaded into a device that has an SMX transceiver, select LTM-10 or LTM-10A platform and then specify the transceiver type supported by your device in the Transceiver Type property.
For Series 5000 chips, the default internal system clock speed is 80.00 MHz (the crystal’s speed external clock speed of 10MHz multiplied by the default clock multiplier of 8), and it may be as low as 5 MHz (10MHz * ½). Note: The 5.00 MHz system clock setting is intended only to facilitate backward compatibility with older designs that cannot scale to higher clock rates. There is no power consumption advantage to using 5.00 MHz over 10.00 MHz.
Figure B-3 Default Memory Properties for FT 5000 Evaluation Board Hardware Template The Memory Addresses box details how on chip and off-chip memory is organized on the selected Neuron Chip or Smart Transceiver model. These values are dependent on the chip type and may be modified depending on the Neuron model and available memory. You can modify the Start and End locations for available memory by clicking the arrows.
Extended Non-Volatile The Series 5000 chips use a serial memory interface for external non-volatile memory devices (EEPROM or flash). The application code and configuration data are stored in the external non-volatile memory device and then copied into the internal RAM when the device is reset. The device application is then executed from the internal RAM. The Extended Non-Volatile memory always starts at 0x4000 and can extend to a configurable address of less than 0xE7FF (a maximum of 42KB).
Setting the Hardware Template Description You can enter an optional description for a hardware template in the Description tab of the NodeBuilder Hardware Template Properties dialog. This description will be saved in the hardware template file and will be available if this hardware template is used in other NodeBuilder projects.
118 Appendix B: Editing Hardware Templates
Appendix C Mini FX Software License Agreement When installing the Mini FX software, you must agree to the terms of the software license agreement detailed in this appendix.
NOTICE This is a legal agreement between you and Echelon Corporation (“Echelon”). YOU MUST READ AND AGREE TO THE TERMS OF THIS SOFTWARE LICENSE AGREEMENT BEFORE ANY LICENSED SOFTWARE CAN BE DOWNLOADED OR INSTALLED OR USED. BY CLICKING ON THE “I AGREE” OR “I ACCEPT” BUTTON OF THIS SOFTWARE LICENSE AGREEMENT, OR DOWNLOADING LICENSED SOFTWARE, OR INSTALLING LICENSED SOFTWARE, OR USING LICENSED SOFTWARE, YOU ARE AGREEING TO BE BOUND BY THE TERMS AND CONDITIONS OF THIS SOFTWARE LICENSE AGREEMENT.
“Mini FX Example Applications” means the Neuron C and C# source code example applications included as part of the Licensed Software which demonstrate the use of the Licensed Software, (i) as provided in the “Examples” directory and its subdirectories, or (ii) as included in the Documentation. “Your Device” means a LONWORKS Device developed by You, which LONWORKS Device incorporates the ISI Libraries. “You(r)” means Licensee, i.e.
This license is not a sale. Title, copyrights and all other rights to the Licensed Software and the Documentation and any copy made by You remain with Echelon. Unauthorized copying of the Licensed Software or the Documentation, or failure to comply with the above restrictions, will result in automatic termination of this license and will make available to Echelon other legal remedies.
YOU RECEIVE NO OTHER WARRANTIES OR CONDITIONS, EXPRESS, IMPLIED, STATUTORY OR OTHERWISE OR IN ANY COMMUNICATION WITH YOU, AND ECHELON AND ITS SUPPLIERS SPECIFICALLY DISCLAIM ANY IMPLIED WARRANTY OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT AND THEIR EQUIVALENTS. Echelon does not warrant that the operation of the Licensed Software will be uninterrupted or error free or that the Licensed Software will meet Your specific requirements.
LANGUAGE The parties hereto confirm that it is their wish that this Agreement, as well as other documents relating hereto, have been and shall be written in the English language only. Any translations are provided for convenience only, and the English language version shall control. Les parties aux présentes confirment leur volonté que cette convention de même que tous les documents y compris tout avis qui s'y rattache, soient rédigés en langue anglaise.
pursuant to DFAR Section 227.7015(a). Any use, modification, reproduction, release, performance, display or disclosure of such technical data shall be governed by the terms of DFAR Section 227.7015(b). Echelon, LON, LonTalk, LonWorks, and Neuron are U.S. registered trademarks of Echelon Corporation.
www.echelon.