ARM Technical Support Knowledge Articles


Applies to: uVision Debugger


Information in this article applies to:


I'm debugging my program using MON51 and the uVision IDE. I can use printf in my program and see the characters output in the uVision Serial Window. However, when I use _getkey to receive characters in my program, all I get are 0x11 characters.


There are several possible causes of this problem.

  1. If you use the serial interrupt to allow the monitor to stop your target program you may experience problems since the monitor (and not your program) receives any characters that are transmitted. You can check the Debug tab in Project Settings and then click on Settings for the Keil Monitor to find this option.
  2. If you single-step thru the program while transmitting characters, you'll probably get some serial port thrashing between the monitor and the target program. When you single-step, between steps the monitor has control of the serial port. Characters that are transmitted during that time are captured by the monitor and are probably thrown away. Try running the program and then sending characters.
  3. In some cases, uVision interrogates the MON51 target using XON and XOFF characters. If you receive 0x11 or 0x13 characters, this may be the problem you are experiencing. To correct this problem, you must ignore XON and XOFF in your program. If you use the standard GETKEY routine, the following substitute function may be added to your project:
    #include <reg51.h>
    char _getkey ()  {
      char c;
      while (!RI);
      c = SBUF;
      RI = 0;
    while (c == 0x11 || c == 0x13);   // IGNORE XON and XOFF
    return (c);


Article last edited on: 2005-07-09 10:47:01

Rate this article

Disagree? Move your mouse over the bar and click

Did you find this article helpful? Yes No

How can we improve this article?

Link to this article
Copyright © 2011 ARM Limited. All rights reserved. External (Open), Non-Confidential