MCBX51: PROBLEMS WITH MON51 AND TIMER 2
Information in this article applies to:
I'm using Timer 2 on the Philips 8xC51RD2 device. My program runs fine under the µVision Simulator, but when I use the Monitor-51 Driver, the program stops at the first line of the initialization of Timer 2. Then, I receive the following message:
CONNECTION TO TARGET SYSTEM LOST!
What is going wrong?
The most likely cause of this is that you are using Timer2 as the baudrate generator for the serial UART. When this is the case, you may not change the configuration of Timer 2 without losing the serial connection (since this will also affect the baudrate of the serial port).
If you must use Timer 2 in your application, you must use a different timer for the serial port baudrate generator.
The Keil MCBx51 Evaluation Board allows you to use an external (16550) UART for Monitor communication. This is selected when you set the DIP switch ext_UART to ON. Using the external UART frees up the on-chip UART and Timer for use by your application.
If you use the MCBx51 Evaluation Board and if the Stop Program Execution with Serial Interrupt option in µVision is enabled (see Project - Options for Target - Debug - Keil Monitor Driver Settings - Stop Program Execution with Serial Interrupt) you must reserve the memory used by the serial interrupt in your application. When you enable the serial interrupt option, the monitor automatically writes the serial interrupt vector. If you have program code or data there, it is overwritten.
Add the following to your application to reserve the serial interrupt of the on-chip 8051 UART.
char code reserve  _at_ 0x23; /* Space for on-chip UART serial interrupt */
Add the following to your application to reserve the serial interrupt of the external UART.
char code reserve  _at_ 0x3; /* Space for EXT0 interrupt */
If you have not enabled Stop Program Execution with Serial Interrupt, you do not have to reserve this memory.
Last Reviewed: Sunday, November 19, 2006
of your data.