370
13.6 Example code
/*********************************************************************
*
*
Solutions for real time microcontroller applications
**********************************************************************
*
*
(c) 2014
*
*
www.segger.com
*
**********************************************************************
----------------------------------------------------------------------
File
: RTT.c
Purpose : Simple implementation for output via RTT.
It can be used with any IDE.
--------
END-OF-HEADER
*/
#include "SEGGER_RTT.h"
static void _Delay(int period) {
int i = 100000*period;
do { ; } while (i--);
}
int main(void) {
int Cnt = 0;
SEGGER_RTT_WriteString(0, "Hello World from SEGGER!\n");
do {
SEGGER_RTT_printf("%sCounter: %s%d\n",
if (Cnt > 100) {
SEGGER_RTT_TerminalOut(1, RTT_CTRL_TEXT_BRIGHT_RED"Counter overflow!");
Cnt = 0;
}
_Delay(100);
Cnt++;
} while (1);
return 0;
}
/*************************** End of file ****************************/
J-Link / J-Trace (UM08001)
CHAPTER 13
SEGGER MICROCONTROLLER GmbH & Co KG
SEGGER Microcontroller GmbH & Co KG
Support: support@segger.com
---------------------------------------------
RTT_CTRL_TEXT_BRIGHT_WHITE,
RTT_CTRL_TEXT_BRIGHT_GREEN,
Cnt);
© 2004-2017 SEGGER Microcontroller GmbH & Co. KG
RTT
*
*
*
*
*
*
*
Need help?
Do you have a question about the J-Link and is the answer not in the manual?