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

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

AW: [avr-gcc-list] About the EEPROM application problem in AVR


From: Haase Bjoern (PT-BEU/EMT) *
Subject: AW: [avr-gcc-list] About the EEPROM application problem in AVR
Date: Fri, 3 Jun 2005 09:04:28 +0200



Again the response is:

Read the manual. (I myself have made the same mistake once. :-) ). Unfortunately, EEPROM handling for atmega48 does not work. Solution is to take the original assembler files from the avr-libc sources and compile them with the correct compile switches for your processor. Avr-libc is compiled for all controllers and assume that the eeprom registers are at another location than they are in fact for atmega48.

Yours,

Björn

Excerpt from the manual:

 

EEPROM handling


Detailed Description

#include <avr/eeprom.h>

This header file declares the interface to some simple library routines suitable for handling the data EEPROM contained in the AVR microcontrollers. The implementation uses a simple polled mode interface. Applications that require interrupt-controlled EEPROM access to ensure that no time will be wasted in spinloops will have to deploy their own implementation.

Note:
All of the read/write functions first make sure the EEPROM is ready to be accessed. Since this may cause long delays if a write operation is still pending, time-critical applications should first poll the EEPROM e. g. using eeprom_is_ready() before attempting any actual I/O.

This library will not work with the following devices since these devices have the EEPROM IO ports at different locations:

 



Von: address@hidden [mailto:address@hidden Im Auftrag von laser lei
Gesendet: Freitag, 3. Juni 2005 03:32
An: address@hidden
Betreff: [avr-gcc-list] About the EEPROM application problem in AVR

Dear All,
     I used the ATmega48 EEPROM stored my parameter.
But I can't read back right data before in my program
I have defined  it.Please see the below part,give me some advice!
     Thanks!
     Laser
#include <inttypes.h>
#include <avr/io.h>
#include <avr/eeprom.h>
 unsigned char EMy_addr __attribute__((section(".eeprom"))) =5;
 unsigned char my_addr; 
 
int main(void)
{
        eeprom_busy_wait();  
        my_addr=eeprom_read_byte(&EMy_addr);   
}


__________________________________________________
赶快注册雅虎超大容量免费邮箱?
http://cn.mail.yahoo.com


reply via email to

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