Keil Logo Arm Logo

Technical Support

C51: ACCESSING SPECIFIC MEMORY BYTES

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

Last Reviewed: Monday, June 07, 2004


Did this article provide the answer you needed?
 
Yes
No
Not Sure
 

arm-logo-small

Keil logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.