ARM Technical Support Knowledge Articles


Applies to: C51 C Compiler


Information in this article applies to:


What does the ONEREGBANK compiler directive do?


When the C51 compiler generates code for an interrupt function that is declared without a USING directive, register bank 0 is selected by default. For example:

void ISR (void) interrupt 1
func (counter++);

generates the following interrupt entry code:

             ; FUNCTION isr1 (BEGIN)
0000 C0E0              PUSH    ACC
0002 C0D0              PUSH    PSW
0004 75D000            MOV     PSW,#00H

Setting the PSW is necessary when you use both high-priority interrupts and low-priority interrupts. If a high-priority interrupt is declared without a using directive, the compiler assumes you want to use registerbank 0. This is required when interrupting low-priority interrupts that HAVE specified a registerbank (with the using directive). By default, the C51 compiler uses this technique to ensure that high-priority interrupts that do not specify a registerbank with the using attribute can interrupt lower priority interrupts that use a different registerbank.

If you only use one registerbank in your program, you can use the ONEREGBANK directive to tell the compiler to avoid selecting registerbank 0 in interrupts that don't specify the using directive.


Article last edited on: 2002-04-08 00:00:00

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