AVR __eeprom: Welche Compiler?

#7624333
Lesenswert?

Hallo zusammen,

ich habe einen alten Quelltext für eine atmega88a, in dem folgendes auftaucht:

1
__eeprom T_EEPROM eeprom = {
2
  0xff,    
3
...
4
};

Das Schreiben (bzw. Lesen) aus dem EEPROM geht dort dann so:

1
  // write the settings back to eeprom
2
  eeprom = ee;
3
  
4
...
5

6
        // save the new settings into eeprom    
7
        eeprom = ee;

Meine AVR Zeiten sind schon lange vorbei, doch welcher Compiler konnte das?

Danke!

(Firma: matzetronics) #7624395
Lesenswert?

Raoul D. schrieb:

oder den ganzen Kram nach avr-gcc umschreiben ...

Das ist keine große Sache:

1
#include <avr/eeprom.h>
2

3
// EEPROM values
4
uint16_t ee_DUMMY __attribute__((section(".eeprom"))); 
5
// deadtime 
6
uint8_t ee_DEAD_TIME_HALF __attribute__((section(".eeprom")))= 48;
7
// commutation
8
uint8_t ee_motor_fwd_commutation __attribute__((section(".eeprom"))) = MOTOR_FWD_COMMUTATION;
9
uint8_t ee_motor_rev_commutation __attribute__((section(".eeprom"))) = MOTOR_REV_COMMUTATION;
10

11
// und spaeter
12
motor_fwd_commutation = eeprom_read_byte(&ee_motor_fwd_commutation);
13
motor_rev_commutation = eeprom_read_byte(&ee_motor_rev_commutation);

Antwort schreiben

Bitte melde dich an, um einen Beitrag zu schreiben.

oder

Mit Google-Account einloggen

Die Registrierung ist kostenlos und dauert nur eine Minute.

Jetzt registrieren