欢迎访问ic37.com |
会员登录 免费注册
发布采购

ATMEGA64A-AU 参数 Datasheet PDF下载

ATMEGA64A-AU图片预览
型号: ATMEGA64A-AU
PDF下载: 下载PDF文件 查看货源
内容描述: 8位微控制器,带有64K字节的系统内可编程闪存 [8-bit Microcontroller with 64K Bytes In-System Programmable Flash]
分类和应用: 闪存微控制器
文件页数/大小: 392 页 / 7964 K
品牌: ATMEL [ ATMEL ]
 浏览型号ATMEGA64A-AU的Datasheet PDF文件第287页浏览型号ATMEGA64A-AU的Datasheet PDF文件第288页浏览型号ATMEGA64A-AU的Datasheet PDF文件第289页浏览型号ATMEGA64A-AU的Datasheet PDF文件第290页浏览型号ATMEGA64A-AU的Datasheet PDF文件第292页浏览型号ATMEGA64A-AU的Datasheet PDF文件第293页浏览型号ATMEGA64A-AU的Datasheet PDF文件第294页浏览型号ATMEGA64A-AU的Datasheet PDF文件第295页  
ATmega64A  
;-the routine must be placed inside the boot space  
; (at least the Do_spm sub routine). Only code inside NRWW section can  
; be read during self-programming (Page Erase and Page Write).  
;-registers used: r0, r1, temp1 (r16), temp2 (r17), looplo (r24),  
; loophi (r25), spmcrval (r20)  
; storing and restoring of registers is not included in the routine  
; register usage can be optimized at the expense of code size  
;-It is assumed that either the interrupt table is moved to the Boot  
; loader section or that the interrupts are disabled.  
.equ PAGESIZEB = PAGESIZE*2  
.org SMALLBOOTSTART  
Write_page:  
;PAGESIZEB is page size in BYTES, not words  
; Page Erase  
ldi  
spmcrval, (1<<PGERS) | (1<<SPMEN)  
call Do_spm  
; re-enable the RWW section  
ldi  
spmcrval, (1<<RWWSRE) | (1<<SPMEN)  
call Do_spm  
; transfer data from RAM to Flash page buffer  
ldi  
ldi  
looplo, low(PAGESIZEB) ;init loop variable  
loophi, high(PAGESIZEB) ;not required for PAGESIZEB<=256  
Wrloop:  
ld  
r0, Y+  
ld  
r1, Y+  
ldi  
spmcrval, (1<<SPMEN)  
call Do_spm  
adiw ZH:ZL, 2  
sbiw loophi:looplo, 2  
brne Wrloop  
;use subi for PAGESIZEB<=256  
; execute Page Write  
subi ZL, low(PAGESIZEB)  
sbci ZH, high(PAGESIZEB)  
;restore pointer  
;not required for PAGESIZEB<=256  
ldi  
spmcrval, (1<<PGWRT) | (1<<SPMEN)  
call Do_spm  
; re-enable the RWW section  
ldi  
spmcrval, (1<<RWWSRE) | (1<<SPMEN)  
call Do_spm  
; read back and check, optional  
ldi  
ldi  
looplo, low(PAGESIZEB) ;init loop variable  
loophi, high(PAGESIZEB) ;not required for PAGESIZEB<=256  
subi YL, low(PAGESIZEB)  
sbci YH, high(PAGESIZEB)  
;restore pointer  
Rdloop:  
lpm  
ld  
r0, Z+  
r1, Y+  
cpse r0, r1  
jmp Error  
sbiw loophi:looplo, 1  
brne Rdloop  
;use subi for PAGESIZEB<=256  
; return to RWW section  
; verify that RWW section is safe to read  
Return:  
lds  
temp1, SPMCSR  
sbrs temp1, RWWSB  
ret  
; If RWWSB is set, the RWW section is not ready yet  
; re-enable the RWW section  
ldi  
spmcrval, (1<<RWWSRE) | (1<<SPMEN)  
call Do_spm  
rjmp Return  
291  
8160C–AVR–07/09  
 复制成功!