Calling the neuron field compiler – Echelon Neuron Field Compiler User Manual

Page 21

Advertising
background image

Neuron Field Compiler User’s Guide

15

To avoid target name conflicts with other Neuron C development tools, target

names used with the Neuron Field Compiler must meet all of the following

conditions:

The name must have at least one character, and no more than 26.

The first character must be in the ASCII range A-Z or a-z. Special

characters are not supported.

All other characters must be in the A-Z, a-z, or 0-9 range, be a space, or

be one of the supported punctuation characters: - _ $ # ~

At least one space or punctuation character must be included.

Recommendation: Set the target name to the Neuron Field Compiler’s client

application name or project name.

Calling the Neuron Field Compiler

Your Neuron C generator tool calls the Neuron Field Compiler (LonNCA32),

parses the output from the compilation (see Example Console Output on page 17

for an example of the output generated by the Neuron Field Compiler), and then

uses the generated image files to download and program a Smart Transceiver or

Neuron Chip.
This section provides a simple example for calling the Neuron Field Compiler.

This section does not describe how to parse the compilation output, but you could

use a standard utility (such as grep) or string functions (such as the C strcmp()

function). This section also does not describe how to download and program a

Smart Transceiver or Neuron Chip, but you could use similar techniques to those

shown below with the Echelon NodeLoad Utility; see the NodeLoad Utility User’s

Guide.
The following simple example is written in the C# language, and it allows you to

call the Neuron Field Compiler and retrieve the compilation output without

reading output files from the disk.

using System;

using System.Diagnostics;

using System.IO;

class MyProgram {

static void Main() {

//

// Initialize the ProcessStartInfo class

//

string fieldCompiler = "LonNCA32.exe";

string ncfile = " myFile.nc";

string hwtemplate = " --hardware=myTemplate.NbHwt";

string pid = " --pid=9515310100000400";

ProcessStartInfo nca = new ProcessStartInfo();

nca.FileName = fieldCompiler;

nca.Arguments = hwtemplate + pid + ncfile;

nca.UseShellExecute = false;

nca.RedirectStandardOutput = true;

Advertising