#define F_CPU 16000000UL
#include <avr/io.h>
#include <avr/interrupt.h>
#include <avr/delay.h>
void port_init() {
DDRA = 0xff; PORTA = 0x00;
DDRB = 0xff; PORTB = 0x00;
DDRC = 0xff; PORTC = 0x00;
DDRD = 0xff; PORTD = 0x00;
DDRE = 0xff; PORTE = 0x00;
DDRF = 0xff; PORTF = 0x00;
DDRG = 0xff; PORTG = 0x00;
}
int main(void) {
unsigned char i = 0;
unsigned char j = 0;
_delay_ms(500);
port_init();
// FOC0:0, WGM00:1, COM01:1, COM00:0, WGM01:0, CS02:0, CS01:1, CS00:1
TCCR0 = 0x63;
TCCR1A = 0xA1;
TCCR1B = 0x03;
TCCR1C = 0x00;
sei();
while(1) {
i = 0; j = 254;
for(; i<254; ) { OCR0 = j; OCR1A = i; _delay_ms(5); i++; j--; } OCR1A = 254; OCR0 = 0;
_delay_ms(250);
i = 254; j = 0;
for(; i>0; ) { OCR1A = i; OCR1B = j; _delay_ms(5); i--; j++; } OCR1A = 0; OCR1B = 254;
_delay_ms(250);
i = 0; j = 254;
for(; i<254; ) { OCR1B = j; OCR0 = i; _delay_ms(5); i++; j--; } OCR0 = 254; OCR1B = 0;
_delay_ms(250);
/* for(i=0; i<254; i++) { OCR0 = i; _delay_ms(7); }
for(i=254; i>0; i--) { OCR0 = i; _delay_ms(7); } OCR0 = 0;
_delay_ms(2540);
for(i=0; i<254; i++) { OCR1A = i; _delay_ms(7); }
for(i=254; i>0; i--) { OCR1A = i; _delay_ms(7); } OCR1A = 0;
_delay_ms(2540);
for(i=0; i<254; i++) { OCR1B = i; _delay_ms(7); }
for(i=254; i>0; i--) { OCR1B = i; _delay_ms(7); } OCR1B = 0;
_delay_ms(2540);
for(i=0; i<254; i++) { OCR0 = OCR1A = i; _delay_ms(7); }
for(i=254; i>0; i--) { OCR0 = OCR1A = i; _delay_ms(7); } OCR0 = OCR1A = 0;
_delay_ms(2540);
for(i=0; i<254; i++) { OCR0 = OCR1B = i; _delay_ms(7); }
for(i=254; i>0; i--) { OCR0 = OCR1B = i; _delay_ms(7); } OCR0 = OCR1B = 0;
_delay_ms(2540);
for(i=0; i<254; i++) { OCR1A = OCR1B = i; _delay_ms(7); }
for(i=254; i>0; i--) { OCR1A = OCR1B = i; _delay_ms(7); } OCR1A = OCR1B = 0;
_delay_ms(2540); */
}
}