[Top][All Lists]

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

[avr-gcc-list] Reading block from EEPROM ?

From: Vincent Trouilliez
Subject: [avr-gcc-list] Reading block from EEPROM ?
Date: Mon, 10 Oct 2005 13:55:50 +0200

Hi list,

Using a mega32. I declared an array of (30) bytes (in RAM) that I
preload at start-up with values from the EEPROM, stored from the first
location of the EEPROM.
At first I used a for loop to read the bytes one after the other: 

#define PARAM_NB 30
uint8_t ui_param_status[PARAM_NB];


    uint8_t i;
    for(i=0 ; i < PARAM_NB ; i++)
        ui_param_status[i] = eeprom_read_byte(i);

that worked fine, but I now would like to use the eeprom_read_block()
function instead, as that would make the code much simpler.

I tried:

eeprom_read_block( ui_param_status, 0, PARAM_NB);

but it's doing something funky !
Once I program this into the AVR, and let avrdude reset it, and it runs
for the first time, it will write 0xFF to all concerned EEPROM
locations ! But, if I then modify the EEPROM content, and power off/on
the AVR, it does read the EEPROM correctly, as expected.

I have already started pulling my hair... 


reply via email to

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