The sends() cannot work. You do while(*s != 0){ sendc(*s++); } So all data is written to TxD0 at once without waiting for one byte to be sent. This is what happens: - You write byte 0. - UART0 starts transmission of byte 0. - You write byte 1 while UART0 transmits byte 0. Data is written to transmit buffer. - You write byte 2 while UART0 transmits byte 0. Data overwrites data in transmit buffer. - You write byte 3 while UART0 transmits byte 0. Data overwrites data in transmit buffer. - You write byte 4 while UART0 transmits byte 0. Data overwrites data in transmit buffer. - You write byte 5 while UART0 transmits byte 0. Data overwrites data in transmit buffer. - UART0 sends data from transmit buffer. You have to wait for the transmit buffer to be empty before you can send the next byte. while(*s != 0){ while (BFF00!=0x00); // wait for transmit buffer empty sendc(*s++); }
↧