i am having this problems with my program.
i am using a 2D array for bit mapping the characters ABCD
i then try to copy this into a single dimesional array called
font.
But when i complier the program i get the error message
Error[74] 176 : Not enough RAM for all variables
i don't know what to do now so i included the program for your
help

for(;;)
{
output_high(PIN_C4); //Turn on led on RC4 to tell us the pic is
//ready to receive data
printf("Powering up !!\r\n"); //Display this on hyperterminal

delay_ms(10000); //The program will delay for 10 seconds and then display
//any data that came in during the 10 second delay
printf("\r\nBuffered data => "); // display this to hypertherminal
while(bkbhit) // cheak if (bkbhit) is set or true
putc( bgetc() ); //if true there is data so display it
printf("\r\n"); //with carriage return and new line

// be displayed is the data received during int
// and not the ones received when displaying
#use rs232(baud=9600, xmit=PIN_A0, rcv=PIN_A1,RESTART_WDT,ERRORS,INVERT)
// Now set the pins and data rate for the serial lcd on ra0
z=0;
for (i=0;i<16;i++) // loop 16 times though buffer[0]
{ // to buffer[15]
//putc(Data[i]); // display the characters in those locations
ch=buffer[i] - 65;
for (n=0;n<8;n++)
{
font[z]=pat[ch][n]; /// and here
z++;
}

if (shift_left(mask,4,0))
mask[0] = 0x01;
// shift to the next column for next time
delay_us(700); // adjust this value to control the drive time
//for the leds
}
--delaycount; // decrement our delay loop counter
}
++startposition; // Point to the next data pattern
if (startposition >= sizeof(pat)) // make sure that we don't exceed the array
{
startposition = 0;

}

}

}

////////////////////////////// END OF DISPLAY FUNCTION /////////////////////////////////////////
___________________________
This message was ported from CCS's old forum
Original Post ID: 10091

Richard Slater

Joined: 08 Sep 2003Posts: 12Location: Cambridge, UK

Re: Not enough ram for variables

Posted: Tue Dec 17, 2002 10:50 am

Hi there,

Have you tried the '#device *=16' directive, as this tells the compiler to use 16 bit pointer values rather than the default of eight. This increases the amount of RAM which is accessible, at the cost of speed and program size.