關於串口發送中斷的理解(轉)


一般單片機發送中斷有兩種出發方式(STM8為例):

  •  Tansmit Data Register empty interrupt
  •  Transmission complete interrupt 

而單片機的發送用到兩個寄存器:發送數據寄存器和移位器

關於串口發送中斷的理解
When a transmission is taking place, a write instruction to the UART_DR register stores the
data in the TDR register. The data is copied in the shift register at the end of the current
transmission.(如果正在發生,數據會先存到發送數據寄存器,等發送完成在送到移位器)
When no transmission is taking place, a write instruction to the UART_DR register places
the data directly in the shift register.(如果沒有發數,數據會直接送到移位器)
發送空中斷和完成中斷的區別就很簡單了。
空中斷:是相對於發送數據寄存器來說的,只要他空了,就會發生中斷,而此時移位寄存器有可能還在工作
完成中斷:是相對於移位寄存器來說的,他完全發送完成了才會發生中斷。


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM