金牌会员
 
- 积分
- 2049
- 威望
- 1155
- 贡献
- 600
- 兑换币
- 333
- 注册时间
- 2012-3-14
- 在线时间
- 147 小时
|
6#

楼主 |
发表于 2013-4-10 21:23:38
|
只看该作者
庞七七 发表于 2013-4-10 20:42 ![]()
楼主解决了吗?最近这个弄得好郁闷。。
很无语啊。。。void exti_init(PORTx portx, u8 n, exti_cfg cfg)
{
SIM_SCGC5 |= (SIM_SCGC5_PORTA_MASK << portx); //开启PORTx端口
PORT_PCR_REG(PORTX[portx], n) = PORT_PCR_MUX(1) | PORT_PCR_IRQC(cfg & 0x7f ) | PORT_PCR_PE_MASK | ((cfg & 0x80 ) >> 7); // 复用GPIO , 确定触发模式 ,开启上拉或下拉电阻
GPIO_PDDR_REG(GPIOx[portx]) &= ~(1 << n); //输入模式
enable_irq(portx + 87); //使能PORT中断,PORTA的ISR中断号为87
}
用的是野火的代码,使用了内部下拉。
|
|