anhnha
Full Member level 6
Could anyone help me explain why the code in 2 is better than 1. I see no difference between them.
1)
it has a explaination but I still can't understand it.
1)
2)UDR = ByteToSend; // Send out the byte value in the variable "ByteToSend"
while ((UCSRA & (1 << TXC)) == 0) {}; // Do nothing until transmission complete flag set
This code is from this page: https://www.avrfreaks.net/index.php?name=PNphpBB2&file=printview&t=45341&start=0while ((UCSRA & (1 << UDRE)) == 0) {}; // Do nothing until UDR is ready for more data to be written to it
UDR = ByteToSend; // Send out the byte value in the variable "ByteToSend"
it has a explaination but I still can't understand it.