Created
December 24, 2012 01:20
-
-
Save ricardas/4367016 to your computer and use it in GitHub Desktop.
Atmega328: EEPROM
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
#include <avr/io.h> | |
void EEPROM_write(unsigned int uiAddress, unsigned char ucData) { | |
while(EECR & (1 << EEPE)); | |
EEAR = uiAddress; | |
EEDR = ucData; | |
EECR |= 1 << EEMPE; | |
EECR |= 1 << EEPE; | |
} | |
unsigned char EEPROM_read(unsigned int uiAddress) { | |
while (EECR & (1 << EEPE)); | |
EEAR = uiAddress; | |
EECR |= (1 << EERE); | |
return EEDR; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
tenk u