28335,中断在gpio0-7上可以实现,在14,15上不能实现,求解。
代码如下:
PieCtrlRegs.PIECTRL.bit.ENPIE = 1; PieCtrlRegs.PIEIER1.bit.INTx4 = 1; PieCtrlRegs.PIEIER1.bit.INTx5 = 1; IER |= M_INT1; EINT; EALLOW;
GpioCtrlRegs.GPAMUX1.bit.GPIO0 = 0; GpioCtrlRegs.GPADIR.bit.GPIO0 = 0; GpioCtrlRegs.GPAQSEL1.bit.GPIO0 = 0;
GpioCtrlRegs.GPAMUX1.bit.GPIO1 = 0; GpioCtrlRegs.GPADIR.bit.GPIO1 = 0; GpioCtrlRegs.GPAQSEL1.bit.GPIO1 = 0; GpioCtrlRegs.GPACTRL.bit.QUALPRD0 = 0x02; EDIS;
// GPIO0 is XINT1, GPIO1 is XINT2
EALLOW;
GpioIntRegs.GPIOXINT1SEL.bit.GPIOSEL = 0; GpioIntRegs.GPIOXINT2SEL.bit.GPIOSEL = 1; EDIS;
// Configure XINT1
XIntruptRegs.XINT1CR.bit.POLARITY = 1; XIntruptRegs.XINT2CR.bit.POLARITY = 1; // Enable XINT1 and XINT2 XIntruptRegs.XINT1CR.bit.ENABLE = 1; XIntruptRegs.XINT2CR.bit.ENABLE = 1; 在gpio0、1上可以实现;
PieCtrlRegs.PIECTRL.bit.ENPIE = 1; PieCtrlRegs.PIEIER1.bit.INTx4 = 1; PieCtrlRegs.PIEIER1.bit.INTx5 = 1; IER |= M_INT1; EINT; EALLOW;
GpioCtrlRegs.GPAMUX1.bit.GPIO14 = 0; GpioCtrlRegs.GPADIR.bit.GPIO14 = 0; GpioCtrlRegs.GPAQSEL1.bit.GPIO14 = 0;
GpioCtrlRegs.GPAMUX1.bit.GPIO15 = 0; GpioCtrlRegs.GPADIR.bit.GPIO15 = 0; GpioCtrlRegs.GPAQSEL1.bit.GPIO15 = 0; GpioCtrlRegs.GPACTRL.bit.QUALPRD1 = 0x02; EDIS;
// GPIO14 is XINT1, GPIO15 is XINT2
EALLOW;
GpioIntRegs.GPIOXINT1SEL.bit.GPIOSEL = 14; GpioIntRegs.GPIOXINT2SEL.bit.GPIOSEL = 15; EDIS;
// Configure XINT1
XIntruptRegs.XINT1CR.bit.POLARITY = 1; XIntruptRegs.XINT2CR.bit.POLARITY = 1; // Enable XINT1 and XINT2 XIntruptRegs.XINT1CR.bit.ENABLE = 1; XIntruptRegs.XINT2CR.bit.ENABLE = 1; 在gpio14、15上不能进中断,求各位大神指点!
mangui zhang:
IO口共有三类寄存器:控制寄存器、数据寄存器和中断控制寄存器。1、 GPIO可以配置为数字I/O或外设I/O口,GPxMUX1(2):‘0’为数字I/O,‘1’为外设I/O口;2: GPIO可以配置为内部电阻上拉功能,GPxPUD:‘0’为上拉,‘1’为禁止上拉3: GPIO具有数字滤波功能,GPxQSEL1(2):量化输入寄存器,可以确定是3周期采样还是6周期采样或者不用采样;GPIO可以配置为内部电阻上拉功能,GPxPUD:‘0’为上拉,‘1’为禁止上拉,4、 输入输出可配置,GPxDIR是控制每个引脚的输入或是输出,‘0’是输入,‘1’是输出; 当GPIO配置为数字I/O时注意:28335引脚作为输出时,虽然可以通过设置GPADAT或GPBDAT改变输出端口的高低电平,但是单独写某一位时可能会使其它引脚产生误操作。为了避免这种现象的产生,改变输出引脚的高低电平时,应该使用GPIOxSET(置位),GPIOxCLEAR(清零),GPIOxTOGGLE(反向,可以代替去翻操作)寄存器载入输出锁存寄存,GPIOxDIR配置方向,1为输出,0为输入.28335引脚作为输入时,采集外部相应引脚的高低电平,只要读取GPADAT或GPBDAT的相应位即可。在有些场合高频干扰会使I/O引脚的读入产生误码。为了避免这种现象,28335引入了采样时间的概念,采样时间可以通过GPxCTRL与GPxQSEL1/2设置为systemclock的倍数(100MHz的频率,最小采样时间为10ns,最大采样时间为5.1us.)