ARM Technical Support Knowledge Articles

BANK SWITCHING COMMON AREA

Applies to: C51 C Compiler

Answer

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.

Article last edited on: 2004-05-08 16:43:49

Rate this article

[Bad]
|
|
[Good]
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