ARM Technical Support Knowledge Articles

ACCESSING SPECIFIC MEMORY BYTES

Applies to: C51 C Compiler

Answer

QUESTION

How can I acess any byte of internal memory without reserving it? At some time, I want to download all memory contents, including all variables and registers. It is no problem working in Assembly, but can I do this from a C program?

ANSWER

Yes. You may use the DBYTE macro in the C51 library. Refer to the ABSACC.H include file. The definition for DBYTE is...

#define DBYTE ((unsigned char volatile data  *) 0)

You may then access any byte in internal memory as shown in the following C code:

for (i = 0; i < 0x80; i++)
  {
  unsigned char my_data;

  my_data = DBYTE[i];  // Read DATA byte
  SBUF = my_data;  // Write DATA byte to serial port

  // Delay for TI here
  }

MORE INFORMATION

Article last edited on: 2004-06-07 09:32:57

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