.include "tn2313def.inc" .def temp = r16 .def LED1 = r17 .def LED2 = r18 .def LED3 = r19 .def comB = r20 //Interrupts .org 0x0000 rjmp main //Reset .org 0x0006 rjmp Overflow //Clock0_Overflow .org 0x000E rjmp MatchB //Clock0_CompareMatchB main: //Stakcpointer ldi temp, RAMEND out SPL, temp //Everything and All ldi LED1, 0b00000001 ldi LED2, 0b00000010 ldi LED3, 0b00000100 //PORTS ldi temp, 0xFF out DDRB, temp //Clock und MatchB ldi comB, 0x01 //Wann wird MatchB ausgelöst? out OCR0B, comB ldi temp, 0b00000011 //WGM0 set to 3 out TCCR0A, temp ldi temp, 0b00000011 //Prescaler = 128 out TCCR0B, temp ldi temp, 0b00000110 //Interrupt-Enable of Overflow & MatchB out TIMSK, temp sei loop: rjmp loop Overflow: mov temp, LED3 or temp, LED2 out PORTB, temp reti MatchB: inc comB out OCR0B, comB cpi comB, 0x00 //AVA 0x01 brsh step3 inc comB lsl LED1 cpi LED1, 0x01 brsh step1 ldi LED1, 0x01 step1: lsl LED2 cpi LED2, 0x01 brsh step2 ldi LED2, 0x01 step2: lsl LED3 cpi LED3, 0x01 brsh step3 ldi LED3, 0x01 step3: mov temp, LED1 OR temp, LED2 out PORTB, temp reti