versuch es nocheinmal so:
Code:
#include <stdio.h>
#include <avr/io.h>
#include <stdlib.h>
int PutChar(char c);
int main(void)
{
float test=5.3;
char str[20];
// USART initialization
// Communication Parameters: 8 Data, 1 Stop, No Parity
// USART Receiver: Off
// USART Transmitter: On
// USART Mode: Asynchronous
// USART Baud rate: 9600
UCSRA=0x00;
UCSRB=0x08;
UCSRC=0x86;
UBRRH=0x00;
UBRRL=0x17;
fdevopen(PutChar,NULL,0);
while(1)
{
dtostrf(test,0,2,str);
printf("%s\n\r",str);
}
return 0;
}
int PutChar(char c)
{
while ( !( UCSRA & (1<<UDRE)) );
UDR=c;
return 0;
}
natürlich musst du wieder die Baudrate bzw. Quarzfrequenz anpassen ...
Lesezeichen