2667|1

1

帖子

0

TA的资源

一粒金砂(初级)

楼主
 

请问LPC11系列的IO口怎么设置中断 [复制链接]

我现在想把一根引脚设置为中断源,请问这个要怎么做呢?
此帖出自NXP MCU论坛

最新回复

/************************************************************************************** * FunctionName   : GPIOSetInterrupt() * Description    : 设置管脚中断:0-边沿触发;1-电平触发 * EntryParameter : port num, bit position, sense, single/doube, polarity * ReturnValue    : None **************************************************************************************/ void GPIOSetInterrupt(uint8 portNum, uint8 bitPosi, uint8 sense, uint8 single, uint8 event) {         if (sense == 0)                      // 触发模式: 0-边沿触发;1-电平触发         {             LPC_GPIO[portNum]->IS &= ~(0x1  详情 回复 发表于 2013-7-10 18:54

点评

/************************************************************************************** * FunctionName : GPIOSetInterrupt() * Description : 设置管脚中断:0-边沿触发;1-电平触发 * EntryParamet  详情 回复 发表于 2013-7-10 18:54
点赞 关注
 

回复
举报

4996

帖子

19

TA的资源

裸片初长成(初级)

沙发
 

回复 楼主tiancaich 的帖子

/**************************************************************************************
* FunctionName   : GPIOSetInterrupt()
* Description    : 设置管脚中断:0-边沿触发;1-电平触发
* EntryParameter : port num, bit position, sense, single/doube, polarity
* ReturnValue    : None
**************************************************************************************/
void GPIOSetInterrupt(uint8 portNum, uint8 bitPosi, uint8 sense, uint8 single, uint8 event)
{
        if (sense == 0)                      // 触发模式: 0-边沿触发;1-电平触发
        {
            LPC_GPIO[portNum]->IS &= ~(0x1<             /* single or double only applies when sense is 0(edge trigger). */
            if (single == 0)                               // 双边沿触设置
                {
                    LPC_GPIO[portNum]->IBE &= ~(0x1<             }
                else
                {                         
                    LPC_GPIO[portNum]->IBE |= (0x1<                 }
        }
        else
        {
            LPC_GPIO[portNum]->IS |= (0x1<         }

        if (event == 0)                                                // 触发电平设置
        {
            LPC_GPIO[portNum]->IEV &= ~(0x1<         }
        else
        {                       
            LPC_GPIO[portNum]->IEV |= (0x1<         }
}
此帖出自NXP MCU论坛
 
个人签名我的博客
 
 

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

随便看看
查找数据手册?

EEWorld Datasheet 技术支持

相关文章 更多>>
关闭
站长推荐上一条 1/10 下一条

 
EEWorld订阅号

 
EEWorld服务号

 
汽车开发圈

About Us 关于我们 客户服务 联系方式 器件索引 网站地图 最新更新 手机版

站点相关: 国产芯 安防电子 汽车电子 手机便携 工业控制 家用电子 医疗电子 测试测量 网络通信 物联网

北京市海淀区中关村大街18号B座15层1530室 电话:(010)82350740 邮编:100190

电子工程世界版权所有 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号 Copyright © 2005-2025 EEWORLD.com.cn, Inc. All rights reserved
快速回复 返回顶部 返回列表