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

upper 128byte of 89S52

How to use upper 128byte of AT89S52.
i.e.
SFRs(80H to FFH)
Address indirectly with KEIL C51 for general purpose which are not in use.
They are directly addressable only as SFR.

according to datasheet:
1. The lower 128 bytes of RAM (00H to 7FH) are directly and indirectly addressable.
2. The higher 128 bytes of RAM (80H to FFH) are indirectly addressable.
3. The special function registers (80H to FFH) are directly addressable only.

Please help me thanks!

Parents Reply Children
  • "I particularly dislike his staunch arrogance and misguided self esteem."

    I would not like to comment on his arrogance or esteem; wouldn't like to throw stones in this glass house ;)

    "... unusual code originates from poor understanding of C."

    In this instance I don't think it could be judged as unusual. I have used similar code to what he posted myself in the past; and I believe that it was fully justifed.

    And concerning one other comment that was made about his code:

    "you have designed a loop where your 8-bit processor will require a 16-bit counter just to be able to detect when it is time to leave the loop. What was wrong with designing the loop in a way that an 8-bit variable can be used?"

    Hardly a cardinal sin! Of no relevance to idata!

    Just wonder if the poster of that comment was aware that some optimising compilers recognise such constructs and convert them to a simple inline functions. In which case the size of the variable could be totally irrelevant! Maybe C51 has the ability to optimise this construct.

    Maybe, one day, Zeusti will have a deeper understanding of C.

    Maybe, one day, Zeusti will be capable of spelling Professor (or even Zeusti?) consistently.

    Maybe it's best if I just avoid getting dragged into this any more.

  • In which case the size of the variable could be totally irrelevant! Maybe C51 has the ability to optimise this construct.

    Optimization is irrelevant here. Using a 16-bit loop counter for a loop over idata exposes a fundamental misunderstanding about the '51 architecture.

    No loop over idata can ever, possibly, need a 16-bit loop counter. There's always less than 256 bytes of available idata, so no loop has to run further than an 8-bit variable can reach.

  • "Using a 16-bit loop counter for a loop over idata exposes a fundamental misunderstanding about the '51 architecture."

    Oh jeez, come on! Even the most experienced of programmers can sometimes come up with quick test functions using code templates that may include 16 bit counters. Haven't you ever done that? I know I have - And I consider myself to have more than just a fundamental understanding of the '51 architecture.

    "No loop over idata can ever, possibly, need a 16-bit loop counter."

    It may not be needed, but where in the rule book does it say you must not do it?

    Might as well extend your comment and say 7-bit ASCII should never be stored in a 16 bit variable - Clearly ludicrous.