Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Memory issue in PIC18F6722

Status
Not open for further replies.

haxan

New Member
Hi,

I want to make an array with 200 elements each being 1 byte meaning 200 bytes of data in RAM.

when i try to do this, it gives error

Error - section '.idata_OM.o' can not fit the section. Section '.idata_OM.o' length=0x00000166

however PIC18F6722 has RAM 3K.

Can anyone please help me how to utilize rest of the RAM.

Is there anyother way to store like 200 bytes of data which is volatile?
 
can anyone please help me to utilize all RAM memory

I think you need to give more details to get some help.

You haven't said if you are working with assembler or C or ...

That looks like a linker error to me, but I can't tell if you are using absolute or relocatable code...

 
Glad you got it.If you do want to initialize it with 0 you dont write only one zero.Either use a loop to write a zero in all locations of the array or write it 200 times separated by commas.
 
If you do want to initialize it with 0 you dont write only one zero.

I have been using this type of initializer before and it works fine for arrays in smaller size.

It even doesn't give error for 95 array elements.

Only when i cross 100 it starts popping out that error.

Code:
unsigned char Data[95] = {0};

The above code works fine.
 
I have been using this type of initializer before and it works fine for arrays in smaller size.

It even doesn't give error for 95 array elements.

Only when i cross 100 it starts popping out that error.

Code:
[B]unsigned char Data[95] = {0}[/B];

The above code works fine.

Hi

Giving Error and actually accomplishing what you say is not always correct.You are right that writing the bold characters above doesnt give any errors but it is no way to initialize an array as can be seen from the picture below.Only databuf[0] has been initialized with the number in brackets.

About your error.You should read the C18 users guide and have a look through Extended mode and NON Extended mode of operation(Appexdix E for simplicity and Run time model for a detailed explanation).To tell you the truth i am surprised that you could create an array of 200 elements(i am not able to create one in MP Lab).This is only possible if you interlace parameter memory and local memory(which i havent been able to do).
 

Attachments

  • justchecking.JPG
    justchecking.JPG
    41 KB · Views: 116
  • c18userguide.pdf
    1.5 MB · Views: 341
I need to restate my self.I could not create a local array of 200 bytes but a global array can be created no problem.
 
Status
Not open for further replies.

Latest threads

Back
Top