Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

16F876 - Initialized array in code memory at fixed address

Status
Not open for further replies.

fl0rin

Newbie level 1
Joined
Aug 29, 2008
Messages
1
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,289
array fixed address

Hi everyone,

I am using Microchip PIC16F876 uC and the Hi-Tech PICC compiler in a project. I need a way to store an array in the code memory at an absolute address. Now I know this could be done using @ operator, but it seems it doesn't to work with arrays which are also initialized when declared. To be more specific:

// this is an initialized arrray stored in code memory
const unsigned char const array[5] = {0x00, 0x11, 0x22, 0x33, 0x44};

// here's what I need, but it's not supported
const unsigned char const array[5] @ 0x1E00 = {0x00, 0x11, 0x22, 0x33, 0x44};

Any suggestion will be appreciated. Thanks.
 

const array in hi-tech compiler at fixed address

You can use #pragma psect directive to assign a new section then add an additional option with linker.
ex: add this into your C source code:
Code:
#pragma psect const%%u=myconst
const unsigned char array[5] = {0x00, 0x11, 0x22, 0x33, 0x44};
add this in linker's command-line option:
Code:
-L-pmyconst=1E00h
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top