[STM32F0] UART的问题

[复制链接]
1227|2
 楼主| bxb_lhj 发表于 2015-5-21 14:11 | 显示全部楼层 |阅读模式
最近在研究051的uart库,,发现一个问题

Bit 5 RXNEIE: RXNE interrupt enable
This bit is set and cleared by software.
0: Interrupt is inhibited
1: A USART interrupt is generated whenever ORE=1 or RXNE=1 in the USARTx_ISR
register

其中ORE产生的中断使用USART_GetITStatus()函数时有问题,因为函数查询了这个
Bit 0 EIE: Error interrupt enable
Error Interrupt Enable Bit is required to enable interrupt generation in case of a framing
error, overrun error or noise flag (FE=1 or ORE=1 or NF=1 in the USARTx_ISR register).
0: Interrupt is inhibited
1: An interrupt is generated when FE=1 or ORE=1 or NF=1 in the USARTx_ISR register.


所以一直返回的没有出发,,我的想法是使用USART_GetFlagStatus()函数来解决。。

问题主要是:ORE标志可以由两个中断使能位来控制中断。。
amanda_s 发表于 2015-5-25 13:57 | 显示全部楼层
不是很理解你的意思。
ORE标志可以在RXNEIE和EIE两个任何一个中断使能的情况下触发中断。
USART_GetITStatus()除了检查标志位,还检查了对应中断是否使能
USART_GetFlagStatus()只检查标志位。
看你的需要了。
周董 发表于 2015-5-25 20:52 | 显示全部楼层
路过!真的很无语!
您需要登录后才可以回帖 登录 | 注册

本版积分规则

21

主题

89

帖子

0

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