Keil Logo

C51: LONG POINTER ARITHMETIC


Information in this article applies to:

  • C51 Version 7.00
  • CX51 Version 7.00

QUESTION

Is it possible to use long pointer arithmetic with the far memory support in Cx51? I'm using a device has a extended XDATA address space. I know that a far object can only be up to 64KB in size and resides within a 64KB segment, but I need to generic pointer access to the whole memory for FLASH programming. Is this possible directly in C?

ANSWER

Yes. In C51 Version 7 we have introduced long pointer arithmetic on far variables for exactly this purpose. For example,

#include <absacc.h>

bit verify (void)  {
  unsigned long addr;

  for (addr = 0; addr < 0x40000; addr++)  {
    if (FVAR (unsigned char, addr) != FCVAR (unsigned char, addr + 0x10000L))  {
      return (0);
    }
  }
}

This program compares the XDATA RAM starting at address 0 with the CODE ROM starting at address 0x10000. You may use similar functions to check that the FLASH was programmed correctly.

MORE INFORMATION

SEE ALSO

Last Reviewed: Monday, July 18, 2005


Did this article provide the answer you needed?
 
Yes
No
Not Sure
 
  Arm logo
Important information

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

Change Settings

Privacy Policy Update

Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.