你好,我的也是flash写不进去,楼主给看看,谢谢
.include "tn13def.inc"
.ORG 0x0000
RJMP Chu_Shi_Hua
.ORG 0x0020
Chu_Shi_Hua:
;定义定时器T/C0
LDI R16,1<<WGM01 ;工作模式CTC
OUT TCCR0A,R16
;定义ADC
LDI R16,(1<<ADEN)|(1<<ADPS1)|(1<<ADPS0) ;开ADC,采样频率8分频
OUT ADCSRA,R16
LDI R16,(1<<ADC2D)|(1<<ADC3D) ;关闭PB3,PB4的数字输入缓冲
OUT DIDR0,R16
; LDI R16,(0<<REFS0)|(0<<ADLAR)|(0<<MUX1);设置ADC
; OUT ADMUX,R16
LDI R16,(1<<SM0)|(1<<SE) ;开ADC模式,使能SLEEP指令
OUT MCUCR,R16
;定义堆栈
LDI R16,LOW(RAMEND)
OUT SPL,R16
SEI ;开全局中断
LDI ZL,LOW(2*Date)
LDI ZH,HIGH(2*Date)
ldi r16,0x33
mov r0,r16
ldi r16,0x44
mov r1,r16
LDI R16,0x01;填充页缓冲器
OUT SPMCSR,R16
SPM
LDI R16,0x03;页擦除
OUT SPMCSR,R16
SPM
; LDI R16,0x05;写页
; OUT SPMCSR,R16
; SPM
;sleep
bb:
;nop
rjmp bb
.ORG 0x10
Date: .DW 0x0100
|