Forum: Mikrocontroller und Digitale Elektronik Probleme mit AVR MEGA UART


von joseph (Gast)


Lesenswert?

Hallo,

ich habe es jetzt auch mit dem MEGA 163 probiert ,
die Uart läuft immer noch nicht.

mit dem 8515 war es kein Problem.

Hier ein sourcecode auszug:

 #include "stdio.h"
 #include "iom163.h"

    int putchar (int c)
     {
       unsigned char test;
       test = UCSRA;
       while((test & 0x20) == 0x00 );
       UDR = c;

       if (c == '\n')
        {
         while((test & 0x20) == 0x00 );
         UDR = 0x0d;
        }

       return c;
      }



     void main (void)
      {
       UBRRHI = 0x00;
       UBRRLO = 0x0B;


       UCSRA = 0x20;
       UCSRB = 0x08;


      while (1)
       {
        printf ("hallo world");
       }
}

Bitte melde dich an um einen Beitrag zu schreiben. Anmeldung ist kostenlos und dauert nur eine Minute.
Bestehender Account
Schon ein Account bei Google/GoogleMail? Keine Anmeldung erforderlich!
Mit Google-Account einloggen
Noch kein Account? Hier anmelden.