.include "tn15def.inc" .def temp=r16 .def pwm=r17 .cseg .org $0000 ;--------------------------------------------------------------- start: ldi temp,0x40 ldi pwm,0x00 out TCCR1,temp ldi temp,0x02 out OCR1A,temp ;--------------------------------------------------------------- INITPORTB: ser Temp out DDRB,Temp clr temp out PORTB,temp ;--------------------------------------------------------------- UP: inc pwm out OCR1A,pwm rcall delay cpi pwm,255 breq down rjmp up ;--------------------------------------------------------------- DOWN: dec pwm out OCR1A,pwm rcall delay cpi pwm,0 breq up rjmp down ;--------------------------------------------------------------- DELAY: ldi r18, $43 LOOP0: ldi r19, $C6 LOOP1: dec r19 brne LOOP1 dec r18 brne LOOP0 nop ret ;---------------------------------------------------------------