ATMEGA323L-4AI Atmel, ATMEGA323L-4AI Datasheet - Page 185

IC AVR MCU 32K LV 4MZ IND 44TQFP

ATMEGA323L-4AI

Manufacturer Part Number
ATMEGA323L-4AI
Description
IC AVR MCU 32K LV 4MZ IND 44TQFP
Manufacturer
Atmel
Series
AVR® ATmegar
Datasheet

Specifications of ATMEGA323L-4AI

Core Processor
AVR
Core Size
8-Bit
Speed
4MHz
Connectivity
I²C, SPI, UART/USART
Peripherals
Brown-out Detect/Reset, POR, PWM, WDT
Number Of I /o
32
Program Memory Size
32KB (16K x 16)
Program Memory Type
FLASH
Eeprom Size
1K x 8
Ram Size
2K x 8
Voltage - Supply (vcc/vdd)
2.7 V ~ 5.5 V
Data Converters
A/D 8x10b
Oscillator Type
Internal
Operating Temperature
-40°C ~ 85°C
Package / Case
44-TQFP, 44-VQFP
Lead Free Status / RoHS Status
Contains lead / RoHS non-compliant
Other names
ATMEGA323L4AI
Assembly code example for a
Boot Loader
1457G–AVR–09/03
;- the routine writes one page of data from RAM to Flash the first data
: location in RAM is pointed to by the Y pointer (lowest address) the first
; data location in Flash is pointed to by the Z-pointer (lowest address)
; - error handling is not included – the routine must be placed inside the
; boot space. Only code inside boot loader section should be read during
; self-programming.
;- registers used: r0, r1, temp1, temp2, looplo, loophi, spmcrval storing and
; restoring of registers is not included in the routine
;
;- It is assumed that the interrupts are disabled
.equ PAGESIZEB = PAGESIZE*2
.org SMALLBOOTSTART
Write_page:
; page erase
Wrloop:
Rdloop:
Return:
; re-enable the Application Section
; transfer data from RAM to Flash page buffer
; execute page write
; re-enable the Application Section
; read back and check, optional
; return to Application Section
; verify that Application Section is safe to read
; re-enable the Applicaiton Section
register usage can be optimized at the expense of code size
ldi
call Do_spm
ldi
call Do_spm
ldi
ldi
ld
ld
ldi
call Do_spm
adiw ZH:ZL, 2
sbiw loophi:looplo, 2
brne Wrloop
subi ZL, low(PAGESIZEB)
sbci ZH, high(PAGESIZEB)
ldi
call Do_spm
ldi
call Do_spm
ldi
ldi
subi YL, low(PAGESIZEB)
sbci YH, high(PAGESIZEB)
lpm
ld
cpse r0, r1
jmp
sbiw loophi:looplo, 2
brne Rdloop
in
sbrs temp1, ASB
ret
ldi
spmcrval, (1<<PGERS) + (1<<SPMEN)
spmcrval, (1<<ASRE) + (1<<SPMEN)
looplo, low(PAGESIZEB) ;init loop variable
loophi, high(PAGESIZEB);not required for PAGESIZEB<=256
r0, Y+
r1, Y+
spmcrval, (1<<SPMEN)
spmcrval, (1<<PGWRT) + (1<<SPMEN)
spmcrval, (1<<ASRE) + (1<<SPMEN)
looplo, low(PAGESIZEB) ;init loop variable
loophi, high(PAGESIZEB);not required for PAGESIZEB<=256
r0, Z+
r1, Y+
Error
temp1, SPMCR
spmcrval, (1<<ASRE) + (1<<SPMEN)
;PAGESIZEB is page size in BYTES, not words
;use subi for PAGESIZEB<=256
;restore pointer
;not required for PAGESIZEB<=256
;restore pointer
;use subi for PAGESIZEB<=256
; If ASB is set, the AS is not ready yet
ATmega323(L)
185

Related parts for ATMEGA323L-4AI