You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
703 B
27 lines
703 B
/*
|
|
* eprom.c
|
|
*
|
|
* Created on: 11.02.2018
|
|
* Author: steffen
|
|
*/
|
|
|
|
|
|
#include "eprom.h"
|
|
|
|
void EEPROM_write(unsigned int uiAddress, unsigned char ucData) {
|
|
while(EECR & (1<<EEWE)); // Wait for completion of previous write
|
|
EEAR = uiAddress; // Set up address and data registers
|
|
EEDR = ucData;
|
|
EECR |= (1<<EEMWE); // Write logical one to EEMWE
|
|
EECR |= (1<<EEWE); // Start eeprom write by setting EEWE
|
|
}
|
|
|
|
|
|
unsigned char EEPROM_read(unsigned int uiAddress) {
|
|
while(EECR & (1<<EEWE)); // Wait for completion of previous write
|
|
EEAR = uiAddress; // Set up address register
|
|
EECR |= (1<<EERE); // Start eeprom read by writing EERE
|
|
return EEDR; // return eeprom data register
|
|
}
|
|
|