Hallo 2mal3,
versuch es einmal mit folgendem Programm. Das sendet das empfangene Zeichen wieder zurück.
Gruß RedBabronCode:unsigned char ReadByte(void) { while ((UCSRA & 0x80) == 0); // Warten bis Zeichen vorhanden return UDR; } void WriteByte(unsigned char data) { while ((UCSRA & 0x20) == 0); // wait for empty transmit buffer UDR = data } voind init(void) { // prepare RS232 UCSRA = 0x00; UCSRB = 0x00; UCSRC = 0x86; // No Parity | 1 Stop Bit | 8 Data Bit UBRRL = 0xCF; // 2400bps @ 8.00MHz UCSRB |= (1 << TXEN); //enable transmit UCSRB |= (1 << RXEN); //enable receive } int main(void) { Init(); while (1) WriteByte(ReadByte()); }







Zitieren

Lesezeichen