ATMEGA162-16PJ Atmel, ATMEGA162-16PJ Datasheet - Page 23

IC MCU AVR 16K 5V 16MHZ 40-DIP

ATMEGA162-16PJ

Manufacturer Part Number
ATMEGA162-16PJ
Description
IC MCU AVR 16K 5V 16MHZ 40-DIP
Manufacturer
Atmel
Series
AVR® ATmegar
Datasheets

Specifications of ATMEGA162-16PJ

Core Processor
AVR
Core Size
8-Bit
Speed
16MHz
Connectivity
EBI/EMI, SPI, UART/USART
Peripherals
Brown-out Detect/Reset, POR, PWM, WDT
Number Of I /o
35
Program Memory Size
16KB (8K x 16)
Program Memory Type
FLASH
Eeprom Size
512 x 8
Ram Size
1K x 8
Voltage - Supply (vcc/vdd)
2.7 V ~ 5.5 V
Oscillator Type
Internal
Operating Temperature
-40°C ~ 85°C
Package / Case
40-DIP (0.600", 15.24mm)
Lead Free Status / RoHS Status
Lead free / RoHS Compliant
Data Converters
-
2513K–AVR–07/09
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
C Code Example
EEPROM_write:
void EEPROM_write(unsigned int uiAddress, unsigned char ucData)
{
}
; Wait for completion of?previous write
sbic EECR,EEWE
rjmp EEPROM_write
; Set up address (r18:r1?) in address register
out
out
; Write data (r16) to da?a register
out
; Write logical one to E?MWE
sbi
; Start eeprom write by ?etting EEWE
sbi
ret
/* Wait for complet?on of previous write */
while(EECR & (1<<EEWE))
/* Set up address and da?a registers */
EEAR = uiAddress;
EEDR = ucData;
/* Write logical on? to EEMWE */
EECR |= (1<<EEMWE);
/* Start eeprom write by?setting EEWE */
EECR |= (1<<EEWE);
;
EEARH, r18
EEARL, r17
EEDR,r16
EECR,EEMWE
EECR,EEWE
ATmega162/V
23

Related parts for ATMEGA162-16PJ