[Top][All Lists]

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

[avr-gcc-list] External EEPROM verses internal EEPROM data handling

From: Prashant D. Kharade
Subject: [avr-gcc-list] External EEPROM verses internal EEPROM data handling
Date: Mon, 4 May 2009 14:25:09 +0530


I am relatively new, not only to Atmel but also to Embedded system.
I am doing my first embedded project, 24 channel Data-Logger system.
This is Time based data logging system.
We are supposed to log the data after every 15 min. 
After each 15 min, 58 bytes of data is supposed to be saved.
The data structure is as follows.

typedef struct eventdata
        {       uint8_t unit_add;
                uint8_t card_add;
                uint8_t event_no;               //Event counter
                uint8_t type;           //Event type
                uint8_t year;           //rtc yesr
                uint8_t month;          //rtc month
                uint8_t day;            //rtc day
                uint8_t hour;           //rtc hour
                uint8_t min;            //rtc min
                uint8_t sec;                    //rtc sec
                uint16_t voltage[24];   // adc counts of 24 channels in an array
        } ED;           // total data = 58 bytes
ED ramdata;                             // current event data in ram
ED temp_ramdata;                        // load eeprom data to this event data 
for sending to uart      
ED EEMEM eepdata[60];                   // 60 events data on EEprom

I am saving this in EEPROM of Atmega128 microcontroller. Each event require 
58bytes. Atmega128 has max 4K EEPROM.
So I can save 4K/58 = 70 events at max.

But now I am supposed to save around 500 events.
So Internal EEPROM cannot be used. So we decided to use EXternal EEPROM on I2C 
I found the readymade library from Peter Fleury on the net.

But I faced following problems.
1. How to declare "ED EEMEM eepdata[60];" (60 events data on EEprom) on 
External memory.
2. Whenever a  time event occurr all the data is stored in RAM (ED ramdata). 
Then in a single command this data was transferred to the EEPROM as follows
   eeprom_write_block((const void*)&ramdata,(void*)&eepdata[event_count-1], 
   Now if I use the external EEPROM, how shall I send structure type ED ?
3. Infact, I have stored data such as calibration, initial data in structures. 
And transfer the data very easily from RAM to EEPROM & viceversa.
4. When any data to be read from EEPROM, I used the command
eeprom_read_block((void*)&temp_ramdata,(const void*)&eepdata[t_event_no-1], 

I do not know how to declare EEPROM variables, or how to use above commands in 
external EEPROM.
I am feeling now, the external EEPROM data handling is very difficult.
How to make it simple. Could you please suggest some good logical ideas.



No virus found in this outgoing message.
Checked by AVG - www.avg.com 
Version: 8.5.287 / Virus Database: 270.12.16/2094 - Release Date: 05/03/09 

reply via email to

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