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

Stack overflow question.

Hi,

I need to write a testprogram for some old PCB with a AT89C51CC03 uC. It contains 256 bytes of iData. I do not have some debugger. In the map file it shows 0x70 is the last declared variable. So stackpointer will point to 0x71 or 0x72. I wrote a function that fills the unused stack memory up to 0xFF with value 0x55 and then execute a second function that searches down for the first non-0x55 byte address as being the highest stackpointer address being used ever. The fill function is executed in main() as the first executed function. The highest stackpointer address is shown by 8 leds. I see the stack growing up to around 0x83 and at that point the program hangs. The stackpointer holding address itself is at 0x81.

My questions are:
- is the stackpointer holding address (SFR) part of the iData?
- why does my program crash witch stackpointer around address 0x80 as in the reference manual it says having 256 bytes address space from 0x00 up to 0xff

Thanks

Henk

Parents
  • No, the 128 byte SFR region is separate from the 128 bytes of IRAM hiding at the same numeric addresses. It's just that the IRAM requires indirect addressing, while direct addressing will access the overlapping SFR region.

    And there doesn't seem to be any required configuration for this chip - the configuration I can see is EXTRAM=0 or EXTRAM=1 for the 2kB of ERAM.

Reply
  • No, the 128 byte SFR region is separate from the 128 bytes of IRAM hiding at the same numeric addresses. It's just that the IRAM requires indirect addressing, while direct addressing will access the overlapping SFR region.

    And there doesn't seem to be any required configuration for this chip - the configuration I can see is EXTRAM=0 or EXTRAM=1 for the 2kB of ERAM.

Children
No data