Hallo zusammen,
ich möchte gerne ein Byte im EEProm speichern und zwar so das jede
speicherzelle mal dran ist um die lebensdauer des roms zu verlängern.
Z.z. Simulier ich das programm noch doch leider funktioniert das nicht
so wie ich mir das vorstelle. An der stelle "read_val =
eeprom_read_byte(eeprom_ptr);" Springt die simulation an eine andere
Stelle im Programm. Hab ich was übersehen? MCU ist ein Attiny13, als IDE
kommt AVR Studio zum einsatz.
1 | //EEProm Pointer
|
2 | uint8_t* eeprom_ptr;
|
3 |
|
4 | void read_last_settings ( void )
|
5 | {
|
6 | uint8_t read_val;
|
7 | for(eeprom_ptr=0; eeprom_ptr<(uint8_t*)64; eeprom_ptr++)
|
8 | {
|
9 | while(!eeprom_is_ready());
|
10 | read_val = eeprom_read_byte(eeprom_ptr);
|
11 | if (read_val != 0xFF )
|
12 | {
|
13 | OCR0A = read_val;
|
14 | return;
|
15 | }
|
16 | }
|
17 | OCR0A = 0xFF;
|
18 | return;
|
19 | }
|
Gruß
mk_hans