Skip to content

Instantly share code, notes, and snippets.

@ricardas
Created December 24, 2012 01:20
Show Gist options
  • Save ricardas/4367016 to your computer and use it in GitHub Desktop.
Save ricardas/4367016 to your computer and use it in GitHub Desktop.
Atmega328: EEPROM
#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;
}
@FrankRietman
Copy link

tenk u

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment