智能车制作

标题: K60的串口中断标志位如何清除?求解 [打印本页]

作者: liuCY    时间: 2012-11-10 12:38
标题: K60的串口中断标志位如何清除?求解
52.3.25 UART 7816 Interrupt Status Register (UARTx_IS7816)
The IS7816 register provides a mechanism to read and clear the interrupt flags. All flags/
interrupts are cleared by writing a 1 to the field location. Writing a 0 has no effect. All
bits are "sticky", meaning they indicate that only the flag condition that occurred since
the last time the bit was cleared, not that the condition currently exists. The status flags
are set regardless of whether the corresponding field in the IC7816 is set or cleared. The
IC7816 controls only if an interrupt is issued to the host processor. This register is
specific to 7816 functionality and the values in this register have no affect on UART
operation and should be ignored if 7816E is not set/enabled. This register may be read or
written at anytime、
这是文档上的有关串口中断寄存器的一些说明,UARTX_IS7816,但是在IAR的寄存器查看,只有UART0_IS7816,其它串口都没有这个寄存器,这该怎么操作???



作者: liuCY    时间: 2012-11-10 12:58
原来是自动清除的,好高端~
作者: 野火    时间: 2012-11-10 13:00
不是自动清,需要你代码去清。读懂一下下面那句话吧:
All flags/interrupts are cleared by writing a 1 to the field location.
作者: liuCY    时间: 2012-11-10 16:48
野火 发表于 2012-11-10 13:00
不是自动清,需要你代码去清。读懂一下下面那句话吧:
All flags/interrupts are cleared by writing a 1  ...

为啥我没有清串口中断标志位,也可以再次产生进入中断呐?请教如何清UART1中断标志?

作者: 野火    时间: 2012-11-10 16:51
liuCY 发表于 2012-11-10 16:48
为啥我没有清串口中断标志位,也可以再次产生进入中断呐?请教如何清UART1中断标志?

cleared by writing a 1,写1就会清0,你的代码,肯定有些地方对寄存器进行写1操作

作者: guojunjunjun200    时间: 2012-11-13 10:00
我现在也在做IC卡驱动,请问一下在产生冷复位时,如何控制TXD由低电平到高电平,还有我看资料上说TXD是开漏的。请问是不是把TXD设置成TXD功能啊!

作者: 996004359    时间: 2013-5-14 10:07
您帮我看看,我的程序哪里不对,为什么用串口调试工具接收不到数据

void main(void)
{       
         
       //开启各个GPIO口的转换时钟
       SIM_SCGC5 = SIM_SCGC5_PORTA_MASK | SIM_SCGC5_PORTB_MASK | SIM_SCGC5_PORTC_MASK | SIM_SCGC5_PORTD_MASK | SIM_SCGC5_PORTE_MASK;
      
       pllinit96M();//设置系统主频率
       GPIO_Init();
       hw_FTM2_init();   
       uart_init(UART0,48000,38400);//串口初始化,端口设定,总线时钟,波特率
     DisableInterrupts;
      
      enableuartreint(UART0,45);//开串口中断
       EnableInterrupts;       
      
           for(;;)  
        {

         
        }       
        
}



void  isr_uart0_re(void)
{
    UART0_IS7816 |=UART_IS7816_INITD_MASK;   //清中断标志
    uint8 ch=0;
    uint8 flag;
   
    DisableInterrupts;
    ch=uart_re1 (UART0,&flag);//串口接收,flag为接收到的数据,ch为返回值返回1则成功
    if(1==ch)
    {
      uart_send1(UART0,1);//发送字节
    }
    EnableInterrupts;
}




欢迎光临 智能车制作 (http://dns.znczz.com/) Powered by Discuz! X3.2