Hallo,
ok, nun geht es fast 
hier nochmal der Code:
main.c
Code:
#define F_CPU 16000000
#include <avr/io.h>
#include <util/delay.h>
#include <inttypes.h>
#include "usart.c"
void wait_ms(int i)
{ int x = 0;
while(x <= i)
{
_delay_ms(1);
x++;
}
}
int main(void)
{
usart_init();
while(1)
{
usart_print("Test\n");
wait_ms(1000);
}
return 0;
}
usart.c
Code:
#define USART_BAUD_RATE 9600
#define USART_BAUD_SELECT (F_CPU/(USART_BAUD_RATE*16l)-1)
void usart_init()
{
/* Set baud rate */
UBRRH = (uint8_t) (USART_BAUD_SELECT>>8);
UBRRL = (uint8_t) USART_BAUD_SELECT;
/* Enable Receiver and Transmitter */
UCSRB = (1<<RXEN) | (1<<TXEN);
/* Set frame format: 8data, 2stop bit */
UCSRC = (1<<URSEL) | (1<<USBS) | (1<<UCSZ0);
}
void usart_transmit(uint8_t data)
{
/* Wait for empty transmit buffer */
while ( !( UCSRA & (1<<UDRE)) )
;
/* Put data into buffer, sends the data */
UDR = data;
}
void usart_print(char *s)
{
do
{
usart_transmit(*s);
}
while (*s++);
}
Nun kommt im Terminal immer Zeichensalat (wenigstens etwas
)
Hast du noch eine Idee an was es liegen könnte?
Viele Grüße,
Johannes[/code]
Lesezeichen