XMON Library Program demonstration

/media/uploads/clemente/_scaled_xmon_lib.png

Design, build and enjoy the mBed is very easy, I would say too!
But sometime we need to "debug" our softwar and "see" some data.

Some time ago I found on the Internet this software really useful. All you need is a serial connection between computers and the system is being developed and has been the ability to "see" the individual variables or data sets.

The PC Program

XMON Micro controller serial port debugger variable view realtime curve tracer
http://webx.dk/XMON/index.htm

XMON is a windows program that show and plot value received fomr the serial port. This is the banner from the XMON documentation:

    // XMON 2.1 ALPHA (autoscaling on/off/min/max) 15 feb 2008
    // XMON is a free utility for monitoring and communication with MCU development
    // Made by DZL (help ideas support testing TST)
    // if this program help you and you are happy to use it, please donate a fee to thomas@webx.dk via paypal
    // any donation will be put into improving XMON, any size of donation small or big will be most appliciated.
    // suggestions and bugs to thomas@webx.dk
    // we will setup a homepage with features and tips and tricks and so on soon, see webx.dk and dzl.dk 

The Library

We must send the data in a precise form. But once this thing done, we are able to display up to four values: integer or float, and up to 4 sets of data.

You'll see the trend of the values acquired by the embedded program. And maybe also update it in real time. The connection to the host PC is via serial port. The maximum speed is 115200baud. Any value that you want to view requires some extra bytes to be displayed. A maximum of 11 bytes are required to display a float.

/media/uploads/clemente/_scaled_xmon_vawe.png

XMON Library

Import programXMON_tst

XMON Library Program demonstration

In summary, to initialize the library you can use this code:

/** Example
 *
 * @code
 * #include "mbed.h"
 * #include "XMONlib.h"
 *
 * XMON xm( USBTX, USBRX);
 *
 * int main()
 * {
 *   // Set the rate to XMON. Remenber to change the program too...
 *   xm.baud( 115200);
 *   ....
 *   xm.viewf( 3.1415, 0);    // view pi value
 *   xm.view( 100, 1);        // view an integer value
 *
 *   xm.plotZero();            // clear the plot area
 *   for (int i=0; i<128; i++)
 *   {
 *       xm.plot( i, 0);       // plot the i value...
 *   }
 *
 *
 */

As a demo I choose to plot and view some usefull data from the FFT software from Ivan Mellen. Copy the program to the mbed and start XMON, set the serial port COM and speed to 115200. Reset the mbed.
Yuo can see the spectrum and some data about a 220Hz signal. At this point you can write the character f to the "Send string" field and press "Send". The 4 value now are some snapshot time: time to copy value, time to calculate FFT, time to calculate spectrum and time to calculate the iFFT. To see the vawe send the character i.

I use the dsPICWorks from Microchip to generate some signal to submit to the FFT. The dsPICWorks is a free programm downloadable from here [1]

With this software you can create different and complicated vawe. I made a simple C program to convert the output file in a header file to import to mbed. Inside the vawe_data.h there is a structure that is generated from this software for the corresponding tim file.

The sintax to convert the tim file is: tim_file_tst <file.tim> [struct_name] > vawe_header.h

See the signal_data folder for some example header file generated. Remenber to include the header file inside the main.

[1] http://www.microchip.com/stellent/idcplg?IdcService=SS_GET_PAGE&nodeId=1406&dDocName=en023587


1 comment on XMON Library Program demonstration:

07 Sep 2014

how to clear the waveform after a particular interval in xmon

Please log in to post comments.