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

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

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


From: Royce Pereira
Subject: Re: [avr-gcc-list] Using flash memory for storing large look up tables
Date: Tue, 24 Jan 2006 15:01:56 +0530
User-agent: Opera M2/9.0 (Win32)

Hi,

Whew!

Have you read the avr-libc manual & the FAQ therein? Please read up the useful 
macros provided for program memory store & access!

If you would have, you would have tried this: (The [2][4] are for example):
//----------------
unsigned todayssunset;

const unsigned sunrise[2][4] PROGMEM ={         1,2,3,4,        6,7,8,9  };

todayssunset= pgm_read_byte(&sunrise[x][y]);
//-----------------
All this and more is covered in the AVR libc manual & FAQ.

--Royce.

On Tue, 24 Jan 2006 12:46:08 +0530, dhananjay deshpande <address@hidden> wrote:

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



--
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/




reply via email to

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