Main Page   Modules   Data Structures   File List   Data Fields   Globals   Related Pages   Examples  

EEPROM handling


avr-libc declarations

#define eeprom_is_ready()   bit_is_clear(EECR, EEWE)
unsigned char eeprom_rb (unsigned int addr)
unsigned int eeprom_rw (unsigned int addr)
void eeprom_wb (unsigned int addr, unsigned char val)
void eeprom_read_block (void *buf, unsigned int addr, size_t n)

IAR C compatibility defines

#define _EEPUT(addr, val)   eeprom_wb(addr, val)
#define _EEGET(var, addr)   (var) = eeprom_rb(addr)

Detailed Description

#include <avr/eeprom.h> 

This header file declares the interface to some simple library routines suitable for handling the data EEPROM contained in the AVR microcontrollers. The implementation uses a simple polled mode interface. Applications that require interrupt-controlled EEPROM access to ensure that no time will be wasted in spinloops will have to deploy their own implementation.

Note:
All of the read/write functions first make sure the EEPROM is ready to be accessed. Since this may cause long delays if a write operation is still pending, time-critical applications should first poll the EEPROM e. g. using eeprom_is_ready() before attempting any actual I/O.

Define Documentation

#define _EEGET var,
addr       (var) = eeprom_rb(addr)
 

read a byte from EEPROM

#define _EEPUT addr,
val       eeprom_wb(addr, val)
 

write a byte to EEPROM

 
#define eeprom_is_ready      bit_is_clear(EECR, EEWE)
 

return 1 if EEPROM is ready for a new read/write operation, 0 if not


Function Documentation

unsigned char eeprom_rb unsigned int    addr
 

read one byte from EEPROM address addr

void eeprom_read_block void *    buf,
unsigned int    addr,
size_t    n
 

read a block of n bytes from EEPROM address addr to buf

unsigned int eeprom_rw unsigned int    addr
 

read one 16-bit word (little endian) from EEPROM address addr

void eeprom_wb unsigned int    addr,
unsigned char    val
 

write a byte val to EEPROM address addr


Generated on Thu Jan 30 22:30:58 2003 for EduNet by doxygen1.2.18