EasyManua.ls Logo

Atmel ATmega48A User Manual

Atmel ATmega48A
567 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #25 background image
25
8271D–AVR–05/11
ATmega48A/PA/88A/PA/168A/PA/328/P
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);
}

Table of Contents

Question and Answer IconNeed help?

Do you have a question about the Atmel ATmega48A and is the answer not in the manual?

Atmel ATmega48A Specifications

General IconGeneral
Architecture8-bit AVR
Flash Memory4 KB
SRAM512 Bytes
EEPROM256 Bytes
Clock Speed20 MHz
I/O Pins23
ADC Channels6
Operating Voltage1.8 - 5.5 V
PWM Channels6
USART1
SPI1
I2C1
Package TypeQFN, MLF
Temperature Range-40°C to 85°C
Packages28-pin PDIP, 32-pin TQFP, 28-pad QFN/MLF

Related product manuals