Keil Logo


Information in this article applies to:

  • C51 Version 5 and 6
  • µVision Version 2.20


I'm debugging my program using MON51 and the µVision IDE. I can use printf in my program and see the characters output in the µVision 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, µVision 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);


Last Reviewed: Saturday, July 9, 2005

Did this article provide the answer you needed?
Not Sure
  Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.

Change Settings

Privacy Policy Update

Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.