// // blink_tim1_int // CLK 16MHz // CNT 15.625KHz (=16/1024) // fosc = CLK/(2*N*(1+OCR1A) // //unsigned char x; ISR ( TIMER1_COMPA_vect ) { static unsigned char x; PORTB = x; x = x ^ 0b00000010; } void setup() { // put your setup code here, to run once: DDRB = 0b00000010; // +---OC1A TCCR1A = 0b00000000; // |||| ++--CTC // ||++------B off   // ++--------A off(9pin) TCCR1B = 0b00001101; // +++---1024分周 // ++------CTC //OCR1A = 10; OCR1A = 15625-1; TIMSK1 = 0b00000010; // COMPA割り込み要求設定 // Arduino の場合、sei() は無くてもいい。 } void loop() { // put your main code here, to run repeatedly: }