Debugging a neuron c application, Debugging with i/o – Echelon Mini EVK User Manual

Page 77

Advertising
background image

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. The next two sections describe how you can improve your debugging

with additional tools that are not included with the Mini EVK.

Debugging with I/O

You can debug an application using I/O statements as described in the

Input/Output section in Chapter 4. For example, if your device has LED
outputs, you can use the outputs to signal events from within your

application. If your device has serial outputs, you can send outputs to the

serial port that you can monitor with Windows HyperTerminal on your
computer.
If your device does not have appropriate outputs to support debugging, you

can initially develop your application on one of the evaluation boards
included with the Mini EVK. If your application does not use the IO10 I/O

pin, you can use the serial port on the evaluation board to display debug

output on your computer as described in Getting Started with Neuron C in
Chapter 4. If your application does use the IO10 I/O pin, you can temporarily

disable the I/O to this pin to debug your application on the evaluation board
using the serial connection.
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 serial output code is highlighted in

bold. For more details on this code, see the examples in Chapter 4.

#include <string.h>

#pragma num_alias_table_entries 2
#pragma run_unconfigured

// Configure the I/O pins
IO_4 input bitshift numbits(8) clockedge(-) ioButtons;
IO_6 output bit ioButtonLd = 1;
IO_10 output serial baud (4800) ioSerialOut;

// Read the MiniGizmo buttons
boolean GetButton(void) {
// 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);
}

// Send a string to the serial port
const char errorString[] = "String too long.";

Mini EVK User’s Guide

71

Advertising