Code:#include <stdio.h> #include <avr/io.h> int PutChar(char c); int main(void) { float test=5.3; // 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) { printf("%f\n\r",test); } return 0; } int PutChar(char c) { while ( !( UCSRA & (1<<UDRE)) ); UDR=c; return 0; }
Lesezeichen