Hallo,

ich möchte mit meinem ATmega169 Zeichen über die serielle
Schnittstelle ausgeben. Ich will dazu 19200 als Baudrate einstellen,
aber wenn ich mir die Zeichen am Terminal ansehe kommt nur
Quatsch raus, außerdem sind die Bits am Oszy nur 400µs lang, also
eine Baudrate von 2400.....

Code:
#define MYF_CPU 8000000UL
#define BAUDRATE 19200UL
#define MYUBRR MYF_CPU/16/BAUDRATE-1

uint16_t ubrr = MYUBRR;


static void initUSART(void)
{
 
    UBRRH = (uint8_t) (ubrr>>8);
    UBRRL = (uint8_t) (ubrr);
 
    // UART start receiver and transmitter 
    // data mode 8N1, asynchronous 
    UCSRB = (1 << RXEN) | (1 << TXEN);
    UCSRC = (1 << UCSZ1) | (1 << UCSZ0);

    // flush receive-buffer 
    do
    {
        UDR;
    }
    while (UCSRA & (1 << RXC));
}


static inline int sendChar (const uint8_t c)
{
    // wait for UART -> ready 
    while (!(UCSRA & (1 << UDRE)))
        ;

    // write/send char 
    UDR = c;

    return 1;
}
Idee? Danke!

RICOLA