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

mapping SFR space

How would I locate a structure to coincide with the beginning of SFR space for the 8051? address 0x80 of directly assessible data memory.

We are using a core8051 (inside an FPGA), and the core8051 lets us map external events to SFR space. So it would be very convienent to define a structure which allows us to more easily access all of SFR space. (we take care not to "stomp" on already defined SFR registers.

How can I do that?

Thanks

Parents
  • And we decided, since the core8051 allows you to directly modify unused SFR registers using external sources (say a buffer read from our detector. The FPGA can modify the SFR space on its own) that we could save quite a few instructions by accessing the FPGA registers as unused SFR, as opposed to xdata space.

    One more thing to consider here is that you use up a lot of SFR space.

    If you need access to a buffer of data (rather than individual status bytes) you could implement a FIFO using SFRs. When you need to read the buffer, you simply initialize the FIFO and read. The FIFO pointer could be designed to automatically increment. Similar techniques have been used by some of the early 8051-based USB devices rather than a large memory-mapped block.

    Jon

Reply
  • And we decided, since the core8051 allows you to directly modify unused SFR registers using external sources (say a buffer read from our detector. The FPGA can modify the SFR space on its own) that we could save quite a few instructions by accessing the FPGA registers as unused SFR, as opposed to xdata space.

    One more thing to consider here is that you use up a lot of SFR space.

    If you need access to a buffer of data (rather than individual status bytes) you could implement a FIFO using SFRs. When you need to read the buffer, you simply initialize the FIFO and read. The FIFO pointer could be designed to automatically increment. Similar techniques have been used by some of the early 8051-based USB devices rather than a large memory-mapped block.

    Jon

Children
  • Jon-

    Yes, indeed that is exactly what we are doing. it is an 8k buffer, but the 8051 only sees a byte, and we read that byte as fast as we can.

    Thanks

  • fast as we can
    Eddie, now you are talking my language. I have, since - due to what I make - "speed is my game" developed tricks galore and maybe, just maybe, I have a trick to speed up what you do.

    If you want to, you can post your 'fast code snippet' and if I see any way to speed it up, I'll happily let you know what it is.

    If confidentiality is an issue and you still want my comment(s) e-mail me. BTW confidentiality is the only reason I find acceptable for communication outside the forum if the issue belong in a forum.

    Erik

  • Excellent! Thanks. I will post some, but it will be a few days, as I have some other project bs to clean up right now.

  • Then a FIFO may be the fastest way to read the data. And, you don't need to worry with indexing thru SFRs. For example:

    sfr FIFO_RESET = 0x??;
    sfr FIFO_READ  = 0x??;
    
    unsigned char xdata buffer [0x2000];
    
    void func (void)
    {
    unsigned char xdata *bp;
    
    FIFO_RESET = 1;
    for (bp=buffer;
         bp < &buffer[sizeof(buffer)];
             *bp++ = FIFO_READ);
    }
    

    Jon