[Top][All Lists]

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

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

From: Steven Michalske
Subject: Re: [avr-gcc-list] External EEPROM verses internal EEPROM data handling
Date: Mon, 4 May 2009 11:06:06 -0700

so your external EEPROM will be accessed by functions you write. The compiler does not know how to interface to the external EEPROM.

The functions you will need will take a pointer to your data structure and then pack it into the external EEPROM, the other will take a pointer and extract the data from the EEPROM into the structure. Both of these functions will need some method for addressing your EEPROM's internal memory

I would suggest that instead of an external I2C EEPROM, that you get a SD card and put a file system on it and append to a text file for your log, Ahh, 1GB of space to work with and CHEAP.

EVEN if you don't use a filesystem it would be effective.


On May 4, 2009, at 1:55 AM, Prashant D. Kharade wrote:


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 bus.
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], sizeof(ED)); 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], sizeof(ED));

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 16:51:00

AVR-GCC-list mailing list

reply via email to

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