智能车制作

 找回密码
 注册

扫一扫,访问微社区

查看: 9463|回复: 6
打印 上一主题 下一主题

[咨询] K60的串口中断标志位如何清除?求解

[复制链接]

9

主题

100

帖子

0

精华

金牌会员

Rank: 6Rank: 6

积分
1198
威望
636
贡献
328
兑换币
225
注册时间
2012-9-4
在线时间
117 小时
跳转到指定楼层
1#
发表于 2012-11-10 12:38:11 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
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,其它串口都没有这个寄存器,这该怎么操作???


9

主题

100

帖子

0

精华

金牌会员

Rank: 6Rank: 6

积分
1198
威望
636
贡献
328
兑换币
225
注册时间
2012-9-4
在线时间
117 小时
2#
 楼主| 发表于 2012-11-10 12:58:15 | 只看该作者
原来是自动清除的,好高端~
回复 支持 反对

使用道具 举报

22

主题

1613

帖子

1

精华

跨届大侠

Rank: 10Rank: 10Rank: 10

积分
6784
QQ
威望
2910
贡献
1540
兑换币
1579
注册时间
2012-3-17
在线时间
1167 小时
3#
发表于 2012-11-10 13:00:23 | 只看该作者
不是自动清,需要你代码去清。读懂一下下面那句话吧:
All flags/interrupts are cleared by writing a 1 to the field location.
回复 支持 反对

使用道具 举报

9

主题

100

帖子

0

精华

金牌会员

Rank: 6Rank: 6

积分
1198
威望
636
贡献
328
兑换币
225
注册时间
2012-9-4
在线时间
117 小时
4#
 楼主| 发表于 2012-11-10 16:48:05 | 只看该作者
野火 发表于 2012-11-10 13:00
不是自动清,需要你代码去清。读懂一下下面那句话吧:
All flags/interrupts are cleared by writing a 1  ...

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

使用道具 举报

22

主题

1613

帖子

1

精华

跨届大侠

Rank: 10Rank: 10Rank: 10

积分
6784
QQ
威望
2910
贡献
1540
兑换币
1579
注册时间
2012-3-17
在线时间
1167 小时
5#
发表于 2012-11-10 16:51:08 | 只看该作者
liuCY 发表于 2012-11-10 16:48
为啥我没有清串口中断标志位,也可以再次产生进入中断呐?请教如何清UART1中断标志?

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

使用道具 举报

0

主题

1

帖子

0

精华

注册会员

Rank: 2

积分
12
威望
9
贡献
3
兑换币
0
注册时间
2012-11-13
在线时间
0 小时
毕业学校
南昌大学
6#
发表于 2012-11-13 10:00:45 | 只看该作者
我现在也在做IC卡驱动,请问一下在产生冷复位时,如何控制TXD由低电平到高电平,还有我看资料上说TXD是开漏的。请问是不是把TXD设置成TXD功能啊!
回复 支持 反对

使用道具 举报

0

主题

9

帖子

0

精华

高级会员

Rank: 4

积分
689
威望
357
贡献
150
兑换币
111
注册时间
2012-7-9
在线时间
91 小时
毕业学校
hegongcheng
7#
发表于 2013-5-14 10:07:59 | 只看该作者
您帮我看看,我的程序哪里不对,为什么用串口调试工具接收不到数据

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;
}
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

关于我们|联系我们|小黑屋|智能车制作 ( 黑ICP备2022002344号

GMT+8, 2024-6-16 20:11 , Processed in 0.052755 second(s), 36 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表