Keil Logo

C51: BANK SWITCHING COMMON AREA

QUESTION

Why must my bank switching program have a common area?

ANSWER

The common area in a bank switching program includes the reset vector, the interrupt vectors and interrupt routines, and other "common" routines.

This is necessary when, for example, your program is executing code in BANK 1 and a serial interrupt occurs. Since the common area is there, the CPU can perform the serial interrupt and execute the ISR code associated with the interrupt. If the common area wasn't there, the 8051 CPU would not "know" how to switch banks to get to the bank that included the serial interrupt service routine.

When an interrupt occurs, the CPU saves the program counter on the stack and loads the PC with the address of the interrupt vector. If the interrupt vector did not address the interrupt service routine, the 8051 would probably crash (or at least execute part of your program instead of the interrupt.) That's why the common area exists.

FORUM THREADS

The following Discussion Forum threads may provide information related to this topic.

Last Reviewed: Saturday, May 8, 2004


Did this article provide the answer you needed?
 
Yes
No
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.