// 『昼夜逆転』工作室 http://jsdiy.web.fc2.com/ // tiny2313 // ATtiny2313テストボード // // LED点滅後、ボタン操作に応じて点灯 // // 2008/09/14 v100 初版 (ATtiny2313TestA.c) #define F_CPU 1000000UL //1MHz #include #include int main(void) { int i; unsigned char x; DDRB = 0b00000111; //LEDが3個 PORTA = 0b00000011; //スイッチが2個 for (i = 0; i < 10; i++) { PORTB = 0b00000111; _delay_ms(200); PORTB = 0b00000000; _delay_ms(200); } while (1) { x = PINA; x = (~x) & 0b00000011; PORTB = x; } }