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

mapped i/o versus internal ram

I'm using the Philips 89c51RD which has 1KB RAM. I also have some devices mapped from 0x0000 to 0xFEFF, I'm acessing these devices using "XBYTE[DEVICE_ADDR]=DEVICE_DATA" (where DEVICE_DATA is the address of the memory mapped i/o and DEVICE_DATA is the data byte wrote to the specific device).

The questions are:
1) Is there some way of using the entire 1KB extended RAM and not drive the A15 to A8 pins low(I'm using these pins for address decoding)when accessing the extended ram?


2) Otherwise, is it possible to configure the address range of the internal (extended)memory (xram) to start at 0xFF00 (with only 256 length in this case) so I can guarantee that the external pins A15 to A8 never goes low when accessing ram memory? How can do that, just setting startup.a51?

Thanks,
Fernanda.

Parents
  • Drew,

    The device will ALWAYS drive the ports regardless of the state of EXTRAM for addresses above 0x0400, but below this:-
    with EXTRAM = 0 it will access internal ram, ports NOT driven.
    or;-
    with EXTRAM = 1 it will access external ram, ports ARE driven.

    Thus if there are any I/O devices below this threshold address (0x0400) then your code could become somthing like:-

    U8 ReadHw(volatile U8 xdata *addr)
    {
       if (&addr < 0x400)
       {
          /* save EA */
          /* clear EA */
          /* save AUXR */
          /* set EXTRAM = 1 */
          /* read device */
          /* restore AUXR and EA (in that order) */
          /* return i/o read data */
       }
       return *addr;  /return i/o read data */
    }
    

    Mark.

Reply
  • Drew,

    The device will ALWAYS drive the ports regardless of the state of EXTRAM for addresses above 0x0400, but below this:-
    with EXTRAM = 0 it will access internal ram, ports NOT driven.
    or;-
    with EXTRAM = 1 it will access external ram, ports ARE driven.

    Thus if there are any I/O devices below this threshold address (0x0400) then your code could become somthing like:-

    U8 ReadHw(volatile U8 xdata *addr)
    {
       if (&addr < 0x400)
       {
          /* save EA */
          /* clear EA */
          /* save AUXR */
          /* set EXTRAM = 1 */
          /* read device */
          /* restore AUXR and EA (in that order) */
          /* return i/o read data */
       }
       return *addr;  /return i/o read data */
    }
    

    Mark.

Children