Created
May 14, 2019 10:56
-
-
Save avr-programmierung/b198b4df9cc2a1cdcd5ffe0f5d4e3cb6 to your computer and use it in GitHub Desktop.
ATmega88 @ 1MHz EEPROM 01
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* eeprom_01.c ATmega88 @ 1MHz */ | |
#include <avr/io.h> | |
#include <avr/eeprom.h> // Headerfile für EEPROM Funktionen einbinden | |
uint8_t x,y,z; | |
int main(void) | |
{ | |
eeprom_write_byte((uint8_t*) 1, 7); // schreibe den Wert 7 in die Speicherzelle 1 | |
eeprom_write_byte((uint8_t*) 2, 1); // schreibe den Wert 1 in die Speicherzelle 2 | |
eeprom_write_byte((uint8_t*) 4, 0xAA); // schreibe den Wert 170 (0xAA) in die Speicherzelle 4 | |
x = eeprom_read_byte((uint8_t*) 1); // lese den Inhalt aus Speicherzelle 1 und speichere in x | |
y = eeprom_read_byte((uint8_t*) 2); // lese den Inhalt aus Speicherzelle 2 und speichere in y | |
z = eeprom_read_byte((uint8_t*) 4); // lese den Inhalt aus Speicherzelle 4 und speichere in z | |
while(1) | |
{ | |
asm ("NOP"); // nichts tun | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment