#ifndef F_CPU #define F_CPU 20000000UL // 20 MHz clock speed #endif #include #define UBRR_VAL (( F_CPU / (16UL * 250000UL)) - 1) int main(void) { // Initialize USART0 // baud UBRR0H = (uint8_t) (UBRR_VAL >> 8); UBRR0L = (uint8_t) UBRR_VAL; // frame format: 8n2 UCSR0C = (1 << USBS0) | (1 << UCSZ01) | (1 << UCSZ00); UCSR0B = (1 << TXEN0); // start sending stuff uint8_t value = 0x00; while (1) { // wait send buffer empty while (!(UCSR0A & _BV(UDRE0))) { } // send next byte UDR0 = value++; } }