long testArray[5][32];
long testArray[2][32];
FAQ-10 How do I create a large object in data memory (> 256 bytes)?
By default, MPLAB C18 assumes that an object will not cross a bank boundary. The
following steps are required to safely use an object that is larger than 256 bytes:
1. The object must be allocated into its own section using the #pragma idata or
#pragma udata directive:
#pragma udata buffer_scn
static char buffer[0x180];
#pragma udata
2. Accesses to the object must be done via a pointer:
char * buf_ptr = &buffer[0];
...
// examples of use
buf_ptr[5] = 10;
if (buf_ptr[275] > 127)
...
3. A region that spans multiple banks must be created in the linker script:
- Linker script before modification:
DATABANK NAME=gpr2 START=0x200 END=0x2FF
DATABANK NAME=gpr3 START=0x300 END=0x3FF
- Linker script after modification:
DATABANK NAME=big START=0x200 END=0x37F PROTECTED
DATABANK NAME=gpr3 START=0x380 END=0x3FF
4. The object’s section (created in Step 1) must be assigned into the new region
(created in Step 3) by adding a SECTION directive to the linker script:
SECTION NAME=buffer_scn RAM=big
It worked correctly for me as well. The only way I can see that it could fail is if the pointer is somehow a near pointer. Does changing it to far unsigned long *greenDisplay_ptr = &greenDisplay[0]; fix it?
Mike.
That's strange. It should work as you coded it. I pasted your code snippets into MPLAB/C18 SIM and it worked OK for me. If you want, you can zip the project directory, attach it here, and I can have a look at it in it's entirety.
It's global?
Can you try making it *static* and see what happens..?
Not really familiar with what all you have but is & = address of?
Might try it without that and see if the array name and index is all that is needed.
Might make your complainer..er uh compiler more happy.
The addresses are unused by the hardware. There is no memory associated with it. You can not use what does not exist.(but in the memory map, 0x800 to 0xFFF is labeled as "unused" ........so it is...unusable? )
The addresses are unused by the hardware. There is no memory associated with it. You can not use what does not exist.
What sort of memory did you have in mind?
Maybe a different flavor of PIC with more ram ?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?