打印
[其他ST产品]

关于STR710中断问题,急迫,求达人相助!

[复制链接]
4230|5
手机看帖
扫描二维码
随时随地手机跟帖
跳转到指定楼层
楼主
gxl_3000|  楼主 | 2007-1-13 10:56 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
我使用IAR4.4写一个基本的UART中断程序,禁止FIFO,将接收字节传回,发现只有中断一次后再也无法进入,试验了几天。。。。

void UART0_IRQHandler(void)
{
    u8  bRByte;

    UART_ByteReceive(UART0, &bRByte, 0xFF);
    UART_ByteSend(UART0, &bRByte);
}

是否需要在中断服务程序里清除中断标志?可是找不到相应函数?

另外,谁有STR710 的Timer0 定时中断产生程序(定时频率200Hz)?帮忙贴一下,好像也是无法产生中断

沙发
starm| | 2007-1-13 11:09 | 只看该作者

iar4.40自带的例子也无法通过么?

C:Program FilesIAR SystemsEmbedded Workbench 4.0 EvaluationARMexamplesSTSTR71xSTR71xLibraryexamplesexamples.eww

有一个uart例子, 看了他的uart isr和你的一样啊.

你可以测试一下例子看看.

使用特权

评论回复
板凳
seawwh| | 2007-1-13 11:12 | 只看该作者

估计是没有清除中断标志,可以用函数清除之

这是STR912的函数,估计STR710也是类似。


/*******************************************************************************
* Function Name  : UART_ClearITPendingBit
* Description    : Clears the UARTx抯 interrupt pending bits.
* Input          : - UARTx: where x can be 0,1or 2 to select the UART peripheral.
*                  - UART_IT: specifies the interrupt pending bit to clear.
*                    More than one interrupt can be cleared using the 搢?operator.
*                    This parameter can be:
*                       - UART_IT_OverrunError: Overrun Error interrupt
*                       - UART_IT_BreakError: Break Error interrupt
*                       - UART_IT_ParityError: Parity Error interrupt
*                       - UART_IT_FrameError: Frame Error interrupt
*                       - UART_IT_ReceiveTimeOut: Receive Time Out interrupt
*                       - UART_IT_Transmit: Transmit interrupt
*                       - UART_IT_Receive: Receive interrupt
*                       - UART_IT_DSR: DSR interrupt
*                       - UART_IT_DCD: DCD interrupt
*                       - UART_IT_CTS: CTS interrupt
*                       - UART_IT_RI: RI interrupt
* Output         : None
* Return         : None
*******************************************************************************/
void UART_ClearITPendingBit(UART_TypeDef* UARTx, u16 UART_IT)
{
  /* Clear the specified interrupt */
  UARTx->ICR &= UART_IT;
}

使用特权

评论回复
地板
gxl_3000|  楼主 | 2007-1-13 11:28 | 只看该作者

通不过啊。。。。

就是使用IAR的例子,无法通过

用的是mxchip的板子,UART查询的例子,调试通过了,证明硬件和连接无问题。

另外定时中断的例子也差不多,进去一次就不行了

使用特权

评论回复
5
starm| | 2007-1-13 12:31 | 只看该作者

UART_ByteReceive(UART0, &bRByte, 0xFF);

UART_ByteReceive(UART0, &bRByte, 0xFF);
会读取UARTx.RxBuf同时清除中断标志

11.3.5 Interrupt control
The UART has a single interrupt request line, called UARTn_interrupt. The status bits in
the UARTn_SR register determine the cause of the interrupt. UARTn_interrupt will go high
when a status bit is 1 (high) and the corresponding bit in the UARTn_IER register is 1 (see
Figure 67).
Note: The UARTn_Status register is read only. The UART_Status bits can only be cleared
by operating on the FIFOs. The RxFIFO and TxFIFO can be reset by writing to the
UARTn_RxReset and UARTn_TxReset registers.

使用特权

评论回复
发新帖 我要提问
您需要登录后才可以回帖 登录 | 注册

本版积分规则

1

主题

2

帖子

0

粉丝