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

P89C51RD2Hxx: How to configure XRAM to 32K

Hi,

Would anyone please advise me the steps as how to configure the settings [startup.a51]?? so that program can access or allocate XDATA varibales in 32K memory size??

Thanking you in advance.

Cheers,
Simon

Parents
  • I use that chip a lot. Your setting of AUXR is correct. If you have any PDATA or XDATA variables that are initialized at compile time (have values prior to executing Main), you need to set AUXR in STARTUP.A51. Do it immediately after the label "STARTUP1:".

    STARTUP calls C_Start to initialize variables after clearing RAM. Thus, it needs to have AUXR set correctly or internal RAM will be used for the first 256/768 (RC2/RD2) bytes of XDATA.

    Also, be careful with P2. If you use PDATA make sure it points to the correct page for your data.

    Just a final note. I always add the following:

    sfr   CKCON = 0x8F;             // Clock control register  

    The latest production of the chip drops the "H" and adds the clock control register. In your main program initialization set CKCON=1. This forces use of a 6x clock and allows all the peripheral devices (timers etc) to run at full speed. The instruction execution on an "H" variate has no ill effects.

Reply
  • I use that chip a lot. Your setting of AUXR is correct. If you have any PDATA or XDATA variables that are initialized at compile time (have values prior to executing Main), you need to set AUXR in STARTUP.A51. Do it immediately after the label "STARTUP1:".

    STARTUP calls C_Start to initialize variables after clearing RAM. Thus, it needs to have AUXR set correctly or internal RAM will be used for the first 256/768 (RC2/RD2) bytes of XDATA.

    Also, be careful with P2. If you use PDATA make sure it points to the correct page for your data.

    Just a final note. I always add the following:

    sfr   CKCON = 0x8F;             // Clock control register  

    The latest production of the chip drops the "H" and adds the clock control register. In your main program initialization set CKCON=1. This forces use of a 6x clock and allows all the peripheral devices (timers etc) to run at full speed. The instruction execution on an "H" variate has no ill effects.

Children