Serial Monitor using a specific PC application: XMON

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers XMONlib.h Source File

XMONlib.h

00001 /* mbed XMON library. 
00002 *    
00003 *    XMON Micro controller serial port debugger variable view realtime curve tracer
00004 *    http://webx.dk/XMON/index.htm
00005 *    
00006 *    XMON is a windows program that show and plot value received fomr the serial port.
00007 *    This is the banner from the XMON documentation:
00008 *    // XMON 2.1 ALPHA (autoscaling on/off/min/max) 15 feb 2008
00009 *    // XMON is a free utility for monitoring and communication with MCU development
00010 *    // Made by DZL (help ideas support testing TST)
00011 *    // if this program help you and you are happy to use it, please donate a fee to thomas@webx.dk via paypal
00012 *    // any donation will be put into improving XMON, any size of donation small or big will be most appliciated.
00013 *    // suggestions and bugs to thomas@webx.dk
00014 *    // we will setup a homepage with features and tips and tricks and so on soon, see webx.dk and dzl.dk 
00015 *
00016 *    Copyright (c) 2011 NXP 3786 
00017 * 
00018 *    Permission is hereby granted, free of charge, to any person obtaining a copy
00019 *    of this software and associated documentation files (the "Software"), to deal
00020 *    in the Software without restriction, including without limitation the rights
00021 *    to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
00022 *    copies of the Software, and to permit persons to whom the Software is
00023 *    furnished to do so, subject to the following conditions:
00024 * 
00025 *    The above copyright notice and this permission notice shall be included in
00026 *    all copies or substantial portions of the Software.
00027 * 
00028 *    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
00029 *    IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
00030 *    FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
00031 *    AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
00032 *    LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
00033 *    OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
00034 *    THE SOFTWARE.
00035 */
00036 
00037 #ifndef __MBED_XMONLIB_H
00038 #define __MBED_XMONLIB_H
00039 
00040 #include "mbed.h"
00041 
00042 #define XMON_AUTO_SCALE_OFF 0
00043 #define XMON_AUTO_SCALE_ON 1
00044 #define XMON_RED 0          // Colors of the PLOT GRAPHS
00045 #define XMON_GREEN 1
00046 #define XMON_BLUE 2
00047 #define XMON_YELLOW 3
00048 
00049 /** XMON Micro controller serial port debugger
00050  *
00051  * @code
00052  * #include "mbed.h"
00053  * #include "XMONlib.h"
00054  *
00055  * XMON xm( USBTX, USBRX);
00056  *
00057  * int main()
00058  * {
00059  *   // Set the rate to XMON. Remenber to change the program too...
00060  *   xm.baud( 115200);
00061  *   ....
00062  *   xm.viewf( 3.1415, 0);    // view pi value
00063  *   xm.view( 100, 1);        // view an integer value
00064  *
00065  *   xm.plotZero();            // clear the plot area
00066  *   for (int i=0; i<128; i++)
00067  *   {
00068  *       xm.plot( i, 0);       // plot the i value...
00069  *   }
00070  *
00071  *
00072  */
00073  
00074 class XMON : public Serial 
00075 {
00076 
00077 public:
00078 
00079     XMON( PinName tx, PinName rx);
00080     
00081     /** Clear and restart x axis for the specified trace
00082      *
00083      * @param trace trace value
00084      */
00085     void plotZero( unsigned int trace);
00086     
00087     /** Clear all trace and restart x axis
00088      * @param none
00089      */
00090     void plotZero( void);
00091     
00092     /** Plot float data
00093      *
00094      * @param data float value to plot.
00095      * @param trace color graph
00096      */
00097     void plotf( float data, unsigned int trace);
00098     
00099     /** View float data
00100      *
00101      * @param data float value to view.
00102      * @param line line label
00103      */
00104     void viewf( float data, unsigned int trace);
00105     
00106     /** Plot signed 32 bits data
00107      *
00108      * @param data signed 32bit value to plot.
00109      * @param trace color graph
00110      */
00111     void plotl( int data,unsigned int trace);
00112     
00113     /** View signed 32 bits data
00114      *
00115      * @param data unsigned short value to view.
00116      * @param line line label
00117      */
00118     void viewl( int data, unsigned int trace);
00119     
00120     /** Plot unsigned 16 bits data
00121      *
00122      * @param data unsigned short value to plot.
00123      * @param trace color graph
00124      */
00125     void plot( unsigned short data, unsigned int trace);
00126     
00127     /** View unsigned 16 bits data
00128      *
00129      * @param data unsigned short value to view.
00130      * @param line line label
00131      */
00132     void view( unsigned short data, unsigned int line);
00133     
00134     /** Put the PLOT GRAPH in auto scale mode
00135      *
00136      * @param s 0 auto scale OFF, 1 auto scale ON
00137      */
00138     void autoscale( char s);
00139 
00140 };
00141 
00142 #endif