avr-gcc-list
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[avr-gcc-list] Using flash memory for storing large look up tables


From: dhananjay deshpande
Subject: [avr-gcc-list] Using flash memory for storing large look up tables
Date: Tue, 24 Jan 2006 07:16:08 +0000 (GMT)

Hi,
I am learning to use AVRGCC. I am using it in AVRSTUDIO.
I have a difficulty for my application of "sunset switch on- sunrise switch off relay", which requires a look up table of ~730 integers to be stored in the program. I do not have any other option but to save this table in program memory.
I am using ATMEGA 8535L, I am using assynchronous timer and external 32kHz crystal for realtime keeping.
Question is how to store and retrieve the table contents.
I started with a little short table of 2 months timing for sunset and sunrise.
the code was as follows
for storing the sunset and sunrise timings
const int __attribute__((section(".text"))) sunrise[2][31]={
                           {601,602,603,604,605,606,607,608,609,610,
                            611,612,613,614,615,616,617,618,619,620,
       621,622,623,624,625,626,627,628,629,630,631}
       ,{                                         }
           };
const int __attribute__((section(".text"))) sunset[2][31]= {
                            {1801,1802,1803,1804,1805,1806,1807,1808,1809,1810,
        1811,1812,1813,1814,1815,1816,1817,1818,1819,1820,
        1821,1822,1823,1824,1825,1826,1827,1828,1829,1830,1831}
         {          }                  };
 
for retrieving
 
todayssunset=sunset[t.month][t.date] ;  //t is a structure .
 
This retrieving doesnot work if I use __attribute__((section(".text"))).
 
If I do not use section(".text") attribute, the table is stored in data space which is insufficient . Is there any way out?  please help.
Thanks in advance     
 
 
avr_learner
 
 
 
 

Send instant messages to your online friends http://in.messenger.yahoo.com


reply via email to

[Prev in Thread] Current Thread [Next in Thread]