Not enough RAM

Discuss with MikroElektronika software developers about current library development.
Post Reply
Author
Message
Habuka
Posts: 5
Joined: 31 Oct 2013 03:20

Not enough RAM

#1 Post by Habuka » 31 Oct 2013 05:18

Hi

I am facing "362 Not enough RAM 'LCD_DATA' xxx.c" error now.
I am using PIC16F884 device and MikroC PRO for PIC V6.0.0 with free license.

Related ode is following.
(I deleted unrelated code. But it still have error.)

Code: Select all

//  TOOL : MikroC PRO for PIC V6.0.0
/*
PIC16F884
Oscillator Selection : INTOSCIO
Watchdog Timer : Disabled
Power-up Timer : Disabled
RE3/MCLR Pin Function : Enabled
Code Protection : Program memory code protection is disabled
Data Code Protection : Dta memory code protection is disabled
Brown-out Reset : Enabled
Internal Extaernal Switchover : Enabled
Fail-Safe Clock Monitor : Enabeled
Low-Voltage Programing : Disabled
In-Circuit Debugger Mode : Disabled

*/

// Variable

unsigned char i = 0;
char LCD_DATA[80] = "123456789012345678901234567890";
char LCD_BUF[21] ="";
//char DUMY1[80] = "AAA";
//char DUMY2[20] ="";

// Prototype
void IoInit(void);

void Disp();

 void main() {

    IoInit();


     while(1)
     {
          Disp();
     }
}

void IoInit(void)
{

OSCCON = 0x70;
ANSEL = 0x1F;
TRISA = 0xEF;
PORTA.RA4 = 0;
ANSELH = 0x07;
TRISB = 0x0F;
PORTA.RB4 = 0;
PORTA.RB5 = 0;
PORTA.RB6 = 0;
PORTA.RB7 = 0;
TRISC = 0x8C;
}

void Disp()
{
    LCD_BUF[i] = LCD_DATA[i];
    //DUMY2[0] =  DUMY1[0];
}

If modify LCD_DATA[81] to LCD_DATA[80] then No error.
And I got following massage.

" Used RAM (bytes): 105 (44%) Free RAM (bytes): 135 (56%)"

It seems enough area for additional one byte.

In this condition, I can allocate DUMY1[80] additionally.
And I got following massage.
" Used RAM (bytes): 205 (85%) Free RAM (bytes): 35 (15%)"

But allocation DUMY1[81] was not allowed.

Is number 80 any limitation for array?

Thank you.

User avatar
marina.petrovic
Posts: 2986
Joined: 18 Apr 2013 08:11

Re: Not enough RAM

#2 Post by marina.petrovic » 31 Oct 2013 12:05

Hi,

Please, take a look at compiler Help file:
PIC Specifics -> PIC16 Specifics.

Also, please, take a look at this forum topic:
http://www.mikroe.com/forum/viewtopic.php?t=8946

Best regards,
Marina

Habuka
Posts: 5
Joined: 31 Oct 2013 03:20

Re: Not enough RAM

#3 Post by Habuka » 01 Nov 2013 02:40

:wink: Thank you very much!
I understood my situation because of GPR size limitation.
I will change to four 21 bytes variables.

Anyway, in HELP, there is a good advice of using "ldm" specifire.
what devices are included in "PIC16 Enhanced family devices" written in HELP?
I couldn't find this "PIC16 Enhanced family devices" except document from MikroElectronika.
I would highly appreciate if anyone provides me such information.

Thank you.

aCkO
Posts: 1119
Joined: 14 Feb 2011 04:07
Location: Bar, Montenegro

Re: Not enough RAM

#4 Post by aCkO » 01 Nov 2013 03:03

Habuka wrote:what devices are included in "PIC16 Enhanced family devices" written in HELP?
See here: http://www.microchip.com/pagehandler/en ... range.html

PIC16 Enhanced family MCUs are denoted as PIC16F1xxx.

Regards

Habuka
Posts: 5
Joined: 31 Oct 2013 03:20

Re: Not enough RAM

#5 Post by Habuka » 01 Nov 2013 03:51

:P Thank you very much!
I confirmed that I can allocate more than 100 bytes variable on PIC16F1454.
Thank you again.

Post Reply

Return to “Library Development Discussion”