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

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
-
Programming Time for
Flash When Using
SPM
Simple Assembly
Code Example for a
Boot Loader
2513K–AVR–07/09
The calibrated RC Oscillator is used to time Flash accesses.
gramming time for Flash accesses from the CPU.
Table 92. SPM Programming Time
Flash Write (Page Erase, Page Write,
and Write Lock bits by SPM)
.equ PAGESIZEB = PAGESIZE*2
.org SMALLBOOTSTART
Write_page:
Wrloop:
Rdloop:
;-the routine writes one?page of data from RAM to Flash
; the first data locatio? in RAM is pointed to by the Y pointer
; the first data locatio? in Flash is pointed to by the Z-pointer
;-error handling is not ?ncluded
;-the routine must be pl?ced inside the boot space
; (at least the Do_spm s?b routine). Only code inside NRWW section can
; be read during self-pr?gramming (page erase and page write).
;-registers used: r0, r1? temp1 (r16), temp2 (r17), looplo (r24),
; loophi (r25), spmcrval?(r20)
; storing and restoring ?f registers is not included in the routine
; register usage can be ?ptimized at the expense of code size
;-It is assumed that eit?er the interrupt table is moved to the Boot
; loader section or that?the interrupts are disabled.
; page erase
ldi
call Do_spm
; re-enable the RWW section
ldi
call Do_spm
; transfer data from RAM to Flash page buffer
ldi
ldi
ld
ld
ldi
call Do_spm
adiw ZH:ZL, 2
sbiw loophi:looplo, 2
brne Wrloop
; execute page write
subi ZL, low(PAGESIZEB)
sbci ZH, high(PAGESIZEB)
ldi
call Do_spm
; re-enable the RWW section
ldi
call Do_spm
; read back and check, optional
ldi
ldi
subi YL, low(PAGESIZEB)
sbci YH, high(PAGESIZEB)
lpm
spmcrval, (1<<PGERS) | (1<<SPMEN)
spmcrval, (1<<RWWSRE) | (1<<SPMEN)
looplo, low(PAGESIZEB)
loophi, high(PAGESIZEB)
r0, Y+
r1, Y+
spmcrval, (1<<SPMEN)
spmcrval, (1<<PGWRT) | (1<<SPMEN)
spmcrval, (1<<RWWSRE) | (1<<SPMEN)
looplo, low(PAGESIZEB)
loophi, high(PAGESIZEB)
r0, Z+
Symbol
Min Programming Time
;PAGESIZEB is page size in BYTES, not
; words
;init loop variable
;not required for PAGESIZEB<=256
;use subi for PAGESIZEB<=256
;restore pointer
;not required for PAGESIZEB<=256
;init loop variable
;not required for PAGESIZEB<=256
;restore pointer
3.7ms
Max Programming Time
Table 92
ATmega162/V
4.5ms
shows the typical pro-
227

Related parts for ATMEGA162-16PJ