可以帮忙解释一下这段代码吗?官方例程里void UART_IRQHandler(void);的一段,就是IIR寄存器的IIR_RDR可以标识接收中断,IIR_RLS又细分出来一个LSR_RDR也是标识接收中断,后面接收的代码都是一样的。我就不清楚了,接收的时候程序到底是走到哪里呢?
-
- if (IIRValue == IIR_RLS) /* Receive Line Status */
- {
- LSRValue = LPC_UART->LSR;
- /* Receive Line Status */
- if (LSRValue & (LSR_OE | LSR_PE | LSR_FE | LSR_RXFE | LSR_BI))
- {
- /* There are errors or break interrupt */
- /* Read LSR will clear the interrupt */
- UARTStatus = LSRValue;
- Dummy = LPC_UART->RBR; /* Dummy read on RX to clear
- interrupt, then bail out */
- return;
- }
- if (LSRValue & LSR_RDR) /* Receive Data Ready */
- {
- /* If no error on RLS, normal ready, save into the data buffer. */
- /* Note: read RBR will clear the interrupt */
- UARTBuffer[UARTCount++] = LPC_UART->RBR;
- if (UARTCount == BUFSIZE)
- {
- UARTCount = 0; /* buffer overflow */
- }
- }
- }
- else if (IIRValue == IIR_RDA) /* Receive Data Available */
- {
- /* Receive Data Available */
- UARTBuffer[UARTCount++] = LPC_UART->RBR;
- if (UARTCount == BUFSIZE)
- {
- UARTCount = 0; /* buffer overflow */
- }
- }
复制代码
[
本帖最后由 zhaojun_xf 于 2012-4-26 07:41 编辑 ]
此帖出自
小平头技术问答
友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。
一周热门 更多>