EEPROM read and write in the AVR Microcontroller with GCC
eeprom_busy_wait ();
data = eeprom_read_word (address);
EEPROMSave.c file:
* Return: whether the operation is successful? , Success: VALID, failed: INVALID
{
********************************* ***********************************/
invalidpage [2] = 0;
uint8_t DataRecover (void)
{
* write time: August 13, 2007
from the hardware in terms of: adding BOD measures are necessary, while the chip power supply filtering is also higher requirements, the chip reset circuit, crystal oscillator (crystal and chip set bit means the chip operating frequency, which affect the EEPROM read and write) should also be carefully handled in order to improve anti-jamming; of course, a well-designed circuit board against the interference of great help;
void EepromWriteByte (unsigned char * address, unsigned char data)
# define EepromPage2Addr (EepromPage1Addr EepromPageSize)
validpage = 0;
/ *** ************************************************** ***************
* written by: my_avr
* write time: August 13, 2007
else
# define EepromPage1Addr (EepromPage0Addr EepromPageSize)
* Function: Check whether the data EEPROM is destroyed, if destroyed, for data recovery
void EepromWriteBlock (unsigned char * buff, unsigned char * address, unsigned char n) < br /> 3. the landlord solutions have a better effect, but I question 14 Floor: up too much EERPOM storage space, you can streamline the look will be better; because AVR internal EEROM area is limited, if there is a lot of stored data cases, there may be a result of selection of high-end chip costs;
* Function: The n-buffer data written into the EEPROM
data = 0;
/ * EEPROM management definitions * /
if (EepromCheck ((uint8_t *) EepromPage3Add, EepromPageSize) == VALID)
/********************* **********************************************
* Return: None