Hier noch die beiden Funktionen:
Code:/***************/ void EEPROM_write(unsigned int uiAddress, unsigned char ucData) /***************/ { /* Wait for completion of previous write */ while(EECR & (1<<EEPE)) { ; } /* Set up address and data registers */ EEAR = uiAddress; EEDR = ucData; /* Write logical one to EEMPE */ EECR |= (1<<EEMPE); /* Start eeprom write by setting EEPE */ EECR |= (1<<EEPE); return; } /***************/ unsigned char EEPROM_read(unsigned int uiAddress) /***************/ { /* Wait for completion of previous write */ while(EECR & (1<<EEPE)) ; /* Set up address register */ EEAR = uiAddress; /* Start eeprom read by writing EERE */ EECR |= (1<<EERE); /* Return data from data register */ return EEDR; }







Zitieren

Lesezeichen