Step 3: building the device application – Echelon Mini FX User Manual

Page 55

Advertising
background image

42

Mini FX Quick-Start Exercise


// 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.

void OnButtonPressed()
{
switchState ^= TRUE;
SetLeds(switchState, ~switchState);
}

// Timer that checks SW1 button every 25ms

mtimer repeating buttonTimer = 25;

when(timer_expires(buttonTimer))
{
static boolean previousButton;

boolean currentButton;
currentButton = GetButton();

if (currentButton && !previousButton){
OnButtonPressed();
}
previousButton = currentButton;
}

4. Save your main.nc Neuron C source file.

5. Proceed to the next section 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.

Step 3: Building the Device Application

You can use the Mini kit to compile your Neuron C application and build an application
image that can be loaded into your device.
When you build your application, the Mini kit will create downloadable application

image files and device interface files. The downloadable application image file is used by
the Mini kit and other network tools to download the compiled application image to a

device. The device interface file describes the external interface for your device. It is

used by network tools such as the LonMaker tool to determine how to bind and configure
your device. The device interface file is also used by the NodeBuilder tool to

automatically create the LNS device template. The device interface file is not used in
this exercise because it does require the device to be configured.
The Mini kit also generates other application image files that are appropriate for to your

hardware. For example, if your hardware contains off-chip memory parts such as the
flash memory device commonly used with a PL 3150 Smart Transceiver, the Mini kit

generates a programmable application image file (.NEI extension) that can be used to

program the flash memory part using a device programmer. For more information on the

Advertising