ARM Technical Support Knowledge Articles

LOCATE STRUCT TO SFR SPACE

Applies to: C51 C Compiler

Answer


Information in this article applies to:


QUESTION

Is there a way to locate a C struct into the 8051's SFR (Special Function Register) area.

ANSWER

Yes. Define the structure in C and declare an external structure. For example:

struct s  {
  unsigned int  i;
  unsigned char c;
};

extern struct s MySfr;  // struct should be in SFR space

Then, create an Assembly Module to define the starting address of the external structure. For example:

PUBLIC MySfr

MySfr DATA  095H       ; start address of struct MySfr

END

MORE INFORMATION

SEE ALSO

Article last edited on: 2005-07-15 09:36:38

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