.include "m128def.inc"
;
.def temp =r16
.def index_1 = R8
.def index_2 = R9
.def index_3 = R10
.def index = r7
RJMP VECT_END
.org OVF3addr
rjmp over_a
over_a:
ldi ZL,low(MAS1<<1)
ldi ZH,high(MAS1<<1)
ADD ZL,index_1
adc ZH,Index
lpm
sts OCR3AL,R0
inc index_1
cp index_1,r14
brne over_b
clr index_1
over_b:
ldi ZL,low(MAS1<<1)
ldi ZH,high(MAS1<<1)
ADD ZL,index_2
adc ZH,index
lpm
sts OCR3BL,R0
inc index_2
cp index_2,r14
brne over_c
clr index_2
over_c:
ldi ZL,low(MAS1<<1)
ldi ZH,high(MAS1<<1)
ADD ZL,index_3
adc ZH,Index
lpm
sts OCR3CL,R0
inc index_3
cp index_3,r14
brne quit_over
clr index_3
quit_over:
reti
VECT_END:
LDI r19,HIGH(RamEnd)
OUT SPH,r19
LDI r19,LOW(RamEnd)
OUT SPL,r19
LDI R16,0b11111111
OUT DDRE,R16
clr index
CLR index_1
ldi r16,33
mov index_2,r16
ldi r16,66
mov index_3,r16
LDI R16,100
MOV R14,R16
CLR R11
LDI R18, 0b00000000
STS TIMSK,R18
ldi r25, (1<<TOIE3)
STS ETIMSK,R25
LDI R16,(1<<COM3A1) | (1<<COM3B1) | (1<<COM3C1) | (1<<WGM30)
STS TCCR3A,R16
LDI R17,(1<<CS31) | (1<<CS32) | (1<<WGM32)
STS TCCR3B,R17
LDI R16,0b11111111
OUT DDRB,R16
LDI R16,3
out OCR2,R16
LDI R17,(1<<COM20) | (1<<WGM21) | (1<<CS20)
out TCCR2,R17
SEI
LOOP:
RJMP LOOP
MAS1:
.db 135,143,151,159,167,174,182,189,196,202,208,214, ... (масив из 100 эл.)
Социальные закладки