From The Compiler, 6 Years ago, written in C.
Embed
  1. #define F_CPU 8000000UL // 8 MHz
  2.  
  3. #include <avr/io.h>
  4. #include <util/delay.h>
  5.  
  6. void main(void) {
  7.     DDRE |= (1 << 4); // PE4: output (OC3B)
  8.     TCNT3 = 0; // initialize counter
  9.     OCR3B = 10; // 6250 Hz
  10.     TCCR3B |= (1 << CS32); // prescaler 256
  11.     TCCR3B |= (1 << WGM32); // CTC mode (clear timer on compare match)
  12.     TCCR3A |= (1 << COM3B0); // toggle OC3B on compare match
  13.     while(1) { /* NOP */ }
  14. }