关于串口发送中断的理解(转)


一般单片机发送中断有两种出发方式(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