Oh oh ich befürchte schlimmes
das ist mein ganzer code. Ich wette jetzt wirds peinlich für michCode:#include <inttypes.h> #include <avr/io.h> #include <avr/signal.h> #include <string.h> void USART_Init (unsigned int baud) { /* Set baud rate */ UBRR0H = (unsigned char)(baud>>8); UBRR0L = (unsigned char)baud; /* Enable reciever and transmitter */ UCSR0B = (1<<RXEN)|(1<<TXEN); /* Set frame format: 8data, 2stop bit*/ UCSR0C = (1<<USBS)|(3<<UCSZ0); } void USART_Transmit (unsigned char data) { /* Wait for empty transmit buffer */ while(!(UCSR0A & (1<<UDRE))) ; /* Put data into buffer, sends the data */ UDR0 = data; } unsigned char USART_Recieve(void) { /* Wait for data to be recieved */ while (!(UCSR0A & (1<<RXC))) ; /* Get and return recieved data from buffer */ return UDR0; }![]()
MFG
Lesezeichen