ARM Technical Support Knowledge Articles

REGISTER VARIABLES

Applies to: C51 C Compiler

Answer


Information in this article applies to:


SYMPTOMS

I'm trying to use the register keyword to declare variables I want to be stored in registers. However, the C51 C compiler seems to ignore this.

CAUSE

This is by design. The 8051 only has 8 general purpose of registers. Each of them is a single byte register. So, declaring 2 unsigned long register variables would consume all of the available registers if this feature were supported.

RESOLUTION

There is no way to declare register variables with the C51 Compiler. If you must use registers, you should consider writing an assembly routine for the function that requires register variables.

SEE ALSO

Article last edited on: 2001-01-23 00:00:00

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