[STM8] STM8中UART2使用发送中断的疑问

[复制链接]
4309|1
 楼主| wk871123 发表于 2011-2-28 12:39 | 显示全部楼层 |阅读模式
本帖最后由 wk871123 于 2011-2-28 13:47 编辑

我在STM8中UART2使用发送中断的时候,当使能TIEN或TCIEN后,再打开全局中断,我也清了TC和TXE位,程序运行,总是不停进发送中断服务程序,望大家提提建议。
Eddie_xiao 发表于 2011-3-23 18:08 | 显示全部楼层
注意看文档, TEX, TC的清楚条件
TXE: Transmit Data Register Empty.
This bit is set by hardware when the content of the TDR register has been
transferred into the shift register. An interrupt is generated if the TIEN bit =1 in the
USART_CR2 register. It is cleared by a write to the USART_DR register.
0: Data is not transferred to the shift register
1: Data is transferred to the shift register
TC: Transmission Complete.
This bit is set by hardware when transmission of a frame containing Data is
complete. An interrupt is generated if TCIEN=1 in the USART_CR2 register. It is
cleared by a software sequence (a read to the USART_SR register followed by a
write to the USART_DR register).
0: Transmission is not complete
1: Transmission is complete

如果使用TXE的话,数据全部发送完了,最好把TEN能关掉。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

3

主题

5

帖子

0

粉丝
快速回复 在线客服 返回列表 返回顶部