Qdatasheet_Logo
Integrated circuits, Transistor, Semiconductors Search and Datasheet PDF Download Site

ATA6612C View Datasheet(PDF) - Atmel Corporation

Part Name
Description
MFG CO.
'ATA6612C' PDF : 312 Pages View PDF
The user should poll the EEPE bit before starting the read operation. If a write operation is in progress, it is neither possible
to read the EEPROM, nor to change the EEAR register.
The calibrated oscillator is used to time the EEPROM accesses. Table 5-3 lists the typical programming time for EEPROM
access from the CPU.
Table 5-3. EEPROM Programming Time
Symbol
EEPROM write (from CPU)
Number of Calibrated RC Oscillator Cycles
26,368
Typ Programming Time
3.3ms
The following code examples show one assembly and one C function for writing to the EEPROM. The examples assume
that interrupts are controlled (e.g. by disabling interrupts globally) so that no interrupts will occur during execution of these
functions. The examples also assume that no flash boot loader is present in the software. If such code is present, the
EEPROM write function must also wait for any ongoing SPM command to finish.
Assembly Code Example
EEPROM_write:
; Wait for completion of previous write
sbic EECR,EEPE
rjmp EEPROM_write
; Set up address (r18:r17) in address register
out
EEARH, r18
out
EEARL, r17
; Write data (r16) to Data Register
out
EEDR,r16
; Write logical one to EEMPE
sbi
EECR,EEMPE
; Start eeprom write by setting EEPE
sbi
EECR,EEPE
ret
C Code Example
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);
}
ATA6612C/ATA6613C [DATASHEET]
43
9111L–AUTO–11/14
Share Link: GO URL

All Rights Reserved © qdatasheet.com  [ Privacy Policy ] [ Contact Us ]