.include "m328pdef.inc"
.def stack=r16
.def temp=r17
.equ increase=5
; configure stack
ldi stack,low(ramend)
out spl,stack
ldi stack,high(ramend)
out sph,stack
;define I/O
ldi temp,0x00
out DDRC,temp
com temp
out PORTC,temp
out DDRB,temp
ldi temp,0x81
sts TCCR1A,temp
ldi temp,0x09
sts TCCR1B,temp
;begin the comparator with 00
ldi temp,0x00
sts OCR1Ah,temp
sts OCR1Al,temp
lds r20,OCR1Al
ldi r21,increase
continue_up: add r20,r21
cpi r20,0xff
breq wait
ldi temp,0x0
sts OCR1Ah,temp
sts OCR1Al,r20
jmp continue_up
wait: jmp wait
delay: ldi r23,0x5
another: dec r23
brne another
ret