This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

accessing external data and program memory


Whenever ,an external data memory is accessed, by using DPTR, the corresponding
DPL and DPH values has to be appear in the Low order address bus (PO) and high order address Bus(P2).

As per the following programme

  #include<reg51.h>
   2          
   3          unsigned char xdata temp _at_ 0x8000;
   4          void main( void)
   5          {
   6   1      while(1)
   7   1              {
   8   2      
   9   2              P0=0X88;
  10   2              P2=0X88;
  11   2       temp=0xf0;
  12   2       P3=temp;
  13   2              }
  14   1      }




I have loaded 0X8000 to DPTR.

Before accessing the external memory at 8000, Simply I am sending at P0 and P2 with 0x88.

When the instruction P3= temp, executes 0xF0 is appearing on the p3.

HOWEVER THE P0 AND P2 VALUES ARE STILL REMAINING SAME , WITHOUT CHANGING TO THE ADDRESSED VALUE
(0x8000).THIS IS WHAT HAPPENS WHILE USING THE DEBUGGER .
Please let me know , why this is so and ,let me know if my understanding is correct.
How about the above subject when accessing the external programme memory