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

Using on-chip XRAM in P89LPC932

Hi,

I'm using P89LPC932 chip and I have the following question:
how can I access to on-chip ram?

I've check the checkbox "Use on-chip ram"
of menu:

Options for Target --> Target

in uvision3 IDE and I've written the following code

#include <stdlib.h>
#include <absacc.h>
char *BuffTX;
char Var = 0x00;

main {

//Reserve memory
init_mempool (&XBYTE [0x0], 0x200);

BuffTX = calloc (10, sizeof (char));
if (BuffTX == NULL)
{
 //Allocating failed
 ...
} else
   {
     *BuffTX = 0x01;
      Var = *BuffTX;
    }

The variable "Var" is always zero!!

Thanx in advance


Parents
  • "I've to send an array on the serial port but the matter is that this array has different size in response of the different message send"

    As Erik says, just make the array big enough for the largest message.
    This is perfectly standard practice.

    You're always going to have to have space for the biggest possible message, so you lose nothing by this!

    Conversely, using dynamic allocation you suffer overheads in memory usage, code size and execution speed.

Reply
  • "I've to send an array on the serial port but the matter is that this array has different size in response of the different message send"

    As Erik says, just make the array big enough for the largest message.
    This is perfectly standard practice.

    You're always going to have to have space for the biggest possible message, so you lose nothing by this!

    Conversely, using dynamic allocation you suffer overheads in memory usage, code size and execution speed.

Children