XDATA Question

Hi,
I have a loop

for (address = 1; address <= 5; address ++)

ram_ptr[address] = 0xFA:

where unsigned char xdata *ram_ptr = 0x0000;
and unsigned int address;

Somehow when i watch the simulation the address never increments and it always write FA in the same address 0x0000. I have also tried using XBYTE[address] to no use.
Any solution to my problem would be greatly appreciated

Parents
  • I'm not sure I understand what you are trying, but to increment an XDATA location with XBYTE, increment an offset from the base address.

      #include <absacc.h>
      
      #define address 0x0000
      
      void main(void)
      {
        unsigned char xdata i;
        while(1)
        {
          for(i = 1; i <= 5; i++)
          {
            XBYTE[address+i] = 0xFF;
          }
        }
      }
    

    Brad

Reply
  • I'm not sure I understand what you are trying, but to increment an XDATA location with XBYTE, increment an offset from the base address.

      #include <absacc.h>
      
      #define address 0x0000
      
      void main(void)
      {
        unsigned char xdata i;
        while(1)
        {
          for(i = 1; i <= 5; i++)
          {
            XBYTE[address+i] = 0xFF;
          }
        }
      }
    

    Brad

Children
More questions in this forum