Using code wizard templates – Echelon IzoT NodeBuilder User Manual

Page 184

Advertising
background image

Each time you generate code using the Code Wizard, it checks whether each of the common files exists
on the Include Search Path property. If a file exists, the Code Wizard uses the one in the common
folder; otherwise it creates the file in the source files folder.

Using Code Wizard Templates

When you generate the Neuron C code for a device interface, the Code Wizard creates the source code
file based on a code template. The code templates define the general infrastructure and layout of the
generated application. In addition, the code templates supply many utility functions for managing
device and functional block status, which you can use in your application, as needed. By default, the
code template used for new device interfaces created with NodeBuilder FX tool is the version 3
template. Previous releases of the NodeBuilder tool used version 2 templates (NodeBuilder 3.1) and
version 1 templates (NodeBuilder 3.0). The following sections describe the version 3, version 2, and
version 1 templates and how to upgrade existing device applications to the new version 3 code
templates.

Version 3 Templates

The version 3 templates include improved code size, speed, and compliance with interoperability
guidelines. The instructional comments have been revised and improved, and the templates have
improved support for applications with a large number of network variables and functional blocks.
Version 3 templates are architecturally identical to version 2 templates except that they use the
CodeWizard-3.lib library. Version 3 templates also use the new #pragma library compiler directive
to automatically link with this library, which means that you no longer have to specify the Code
Wizard library in your project.

You can upgrade device applications written for a 3100 Series chip to the new version 3 code
templates when porting them to a 5000 or 6000 Series chip. To do this, follow these steps:

1. Create a new device template that includes a hardware template that uses the Neuron 5000

processor or FT 5000/FT 6000 Smart Transceiver. See Creating Device Templates in Chapter 5
for more information.

2. Create the device interface with the NodeBuilder Code Wizard based on the existing device. See

Defining the Device Interface earlier in this chapter for more information.

3. Generate the Neuron C code for the device interface.

4. Manually copy your Neuron C code from the old application into the new application.

Note: The Neuron C Version 2.2 language includes the following new keywords: interrupt,
__lock, stretchedtriac, __slow, __fast, and __parity. Some of these keywords use a double
underscore prefix to avoid any naming collisions within existing device applications.

5. Remove any references to CodeWizard.lib library from your device template, as the version 3

templates automatically link with the revised CodeWizard-3.lib library.

6. Build your upgraded device application. See Chapter 8, Building and Downloading Device

Applications, for more information.

Version 2 Templates

The version 2 templates moved most utility functions from the application space into the
CodeWizard.lib library, and they included improvements to code size, speed, and compliance with
interoperability guidelines. The Code Wizard still supports applications based on version 2 templates.

You should upgrade existing NodeBuilder projects to the Version 3 template; however, you can
continue using the Code Wizard with version 2 templates. To continue using version 2 templates,
verify that your device template references the standard CodeWizard.lib library. Typically, device
templates created with earlier versions of the NodeBuilder tool already reference this library, but you
may need to add an explicit reference to it in some cases (see Inserting a Library into a NodeBuilder
Device Template
in Chapter 5 for how to do this).

170

Defining Device Interfaces and Creating their Neuron C Framework

Advertising