[Top][All Lists]

[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)



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.


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

  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]={
       ,{                                         }
const int __attribute__((section(".text"))) sunset[2][31]= {
         {          }                  };
 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

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]