0
Follow
0
View

About the problem of #c language # : MCU serial port module

Cristiano8880912 注册会员
2023-02-28 02:13

This answer quotes ChatGPT

According to the code provided, TI(Transmit Interrupt) is a flag bit indicating whether the UART send register is empty. When TI is 1, it means that the UART send register is empty and data can continue to be sent. In this code, data is not sent in interrupt mode, but in the main program through the loop mode, so TI does not automatically clear zero.

After each sending of data, the program needs to wait enough time to ensure that the data has been sent. Here, the Delay function is used to delay 1 millisecond to ensure that the data is sent correctly. If no delay is added or the delay is insufficient, the sent data may be incomplete or lost, resulting in communication errors.