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.

Memory allocation problem in PIC18F

Status
Not open for further replies.

sukhavsa

Newbie level 6
Joined
Nov 14, 2009
Messages
11
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,390
I am trying to develop a program in which i will need a look-up table, it is an array of integers, i will be having 1000 entries in it.

the size of this is beyond the data memory, so i am using program memory to store this data using - #pragma romdata table[1000].
The problem here is i will have to initialize the lookup table with the values computed in the same program. I need to be able to write to the above block of data in program memory atleast once.

could someone suggest me a way how i can get around this please....
any help is highly appreciated

the microcontroller i am using is PIC18F8722
 

Hi,

Am not a C programmer, but could you not use four lookup tables, each with 250 entries and before you actually lookup the value, test your data to determine which table it needs to go to.

To address 1000 bytes you need to use the FSR Registers FSR0 ,1 or 2 , but do not know how you involke them in C
 

If I understand the problem, you want the table to be in RAM not ROM. Although some PICs can write into their own program space, it sounds like your table will contain variables rather than constants so RAM is the better option.

To handle large tables in PIC18 wherever they are, use the TBLWT and TBLRD instructions which can access data throughout the entire memory range.

Brian.
 

    sukhavsa

    Points: 2
    Helpful Answer Positive Rating
Thanks all
@Brian the table read and write solved the problem... thanks a bunch
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top