群里的高手谁能告诉我这个程序为什么进不了中断?
时间:10-02
整理:3721RD
点击:
#include "DSP2833x_Device.h"
#include "DSP2833x_examples.h"
#include "LED.h"
/***********************函数声明**********************/
void DELAY1(Uint32 t);
interrupt void Light_led1();
interrupt void Light_led2();
#define TIME 10000000
/***********************主程序************************/
void DELAY1(Uint32 t)
{
Uint32 i;
for (i=0;i<t;i++);
}
void main()
{
/*******初始化*********/
InitSysCtrl();
DINT;
InitPieCtrl();
IER=0x0000;
IFR=0x0000;
InitPieVectTable();
//Init_LED();
//Init_KEYBOARD();
/*******外部中断PIE向量表配置*********/
EALLOW;
//PieVectTable.XINT1=&Light_led1;
//PieVectTable.XINT2=&Light_led2;
EDIS;
/*******PIE,CPU中断使能*********/
PieCtrlRegs.PIECTRL.bit.ENPIE=1;
PieCtrlRegs.PIEIER1.bit.INTx4=1;
PieCtrlRegs.PIEIER1.bit.INTx5=1;
IER |= M_INT1;
EINT; //开全局中断
/*外部中断采样频率(与系统时钟相同)*/
EALLOW;
GpioCtrlRegs.GPBPUD.bit.GPIO60=0; //LED10输出设置初始化
GpioDataRegs.GPBSET.bit.GPIO60=1; //
GpioCtrlRegs.GPBMUX2.bit.GPIO60=0; //
GpioCtrlRegs.GPBDIR.bit.GPIO60=1; //
GpioCtrlRegs.GPBPUD.bit.GPIO61=0; //LED11输出设置初始化
GpioDataRegs.GPBSET.bit.GPIO61=1; //
//GpioDataRegs.GPBCLEAR.bit.GPIO61=0; //
GpioCtrlRegs.GPBMUX2.bit.GPIO61=0; //
GpioCtrlRegs.GPBDIR.bit.GPIO61=1; //
EDIS;
EALLOW;
GpioCtrlRegs.GPADIR.bit.GPIO14=0; //K3输入设置初始化
GpioCtrlRegs.GPAMUX1.bit.GPIO14=0; //
GpioCtrlRegs.GPADIR.bit.GPIO15=0; //K4输入设置初始化
GpioCtrlRegs.GPAMUX1.bit.GPIO15=0; //
EDIS;
EALLOW;
GpioCtrlRegs.GPAQSEL1.bit.GPIO14=0;
GpioCtrlRegs.GPAQSEL1.bit.GPIO15=0;
EDIS;
/***********中断I/O接口************/
GpioIntRegs.GPIOXINT1SEL.bit.GPIOSEL=0x0E;
GpioIntRegs.GPIOXINT2SEL.bit.GPIOSEL=0x0F;
/*******触发方式(下降沿)*********/
XIntruptRegs.XINT1CR.bit.POLARITY=0;
XIntruptRegs.XINT2CR.bit.POLARITY=0;
/*********使能XINT1、XINT2*********/
XIntruptRegs.XINT1CR.bit.ENABLE=1;
XIntruptRegs.XINT2CR.bit.ENABLE=1;
/**************D10、D11屏蔽******************/
for(;;);
}
/*********************中断子程序***********************/
interrupt void Light_led1(void)
{
Uint32 i;
int A;
A=K3_SWITCH;
for(i=0;i<10000000;i++);
while(A==0)
D10_ON;
DELAY1(TIME);
PieCtrlRegs.PIEACK.all=PIEACK_GROUP1;
}
interrupt void Light_led2(void)
{
Uint32 i;
Uint32 j;
int B;
B=K4_SWITCH;
for(i=0;i<10000000;i++);
while(B==0)
for(j=0;j<5;j++)
{
D11_ON;
DELAY1(TIME);
D11_OFF;
DELAY1(TIME);
}
PieCtrlRegs.PIEACK.all=PIEACK_GROUP1;
}
#include "DSP2833x_examples.h"
#include "LED.h"
/***********************函数声明**********************/
void DELAY1(Uint32 t);
interrupt void Light_led1();
interrupt void Light_led2();
#define TIME 10000000
/***********************主程序************************/
void DELAY1(Uint32 t)
{
Uint32 i;
for (i=0;i<t;i++);
}
void main()
{
/*******初始化*********/
InitSysCtrl();
DINT;
InitPieCtrl();
IER=0x0000;
IFR=0x0000;
InitPieVectTable();
//Init_LED();
//Init_KEYBOARD();
/*******外部中断PIE向量表配置*********/
EALLOW;
//PieVectTable.XINT1=&Light_led1;
//PieVectTable.XINT2=&Light_led2;
EDIS;
/*******PIE,CPU中断使能*********/
PieCtrlRegs.PIECTRL.bit.ENPIE=1;
PieCtrlRegs.PIEIER1.bit.INTx4=1;
PieCtrlRegs.PIEIER1.bit.INTx5=1;
IER |= M_INT1;
EINT; //开全局中断
/*外部中断采样频率(与系统时钟相同)*/
EALLOW;
GpioCtrlRegs.GPBPUD.bit.GPIO60=0; //LED10输出设置初始化
GpioDataRegs.GPBSET.bit.GPIO60=1; //
GpioCtrlRegs.GPBMUX2.bit.GPIO60=0; //
GpioCtrlRegs.GPBDIR.bit.GPIO60=1; //
GpioCtrlRegs.GPBPUD.bit.GPIO61=0; //LED11输出设置初始化
GpioDataRegs.GPBSET.bit.GPIO61=1; //
//GpioDataRegs.GPBCLEAR.bit.GPIO61=0; //
GpioCtrlRegs.GPBMUX2.bit.GPIO61=0; //
GpioCtrlRegs.GPBDIR.bit.GPIO61=1; //
EDIS;
EALLOW;
GpioCtrlRegs.GPADIR.bit.GPIO14=0; //K3输入设置初始化
GpioCtrlRegs.GPAMUX1.bit.GPIO14=0; //
GpioCtrlRegs.GPADIR.bit.GPIO15=0; //K4输入设置初始化
GpioCtrlRegs.GPAMUX1.bit.GPIO15=0; //
EDIS;
EALLOW;
GpioCtrlRegs.GPAQSEL1.bit.GPIO14=0;
GpioCtrlRegs.GPAQSEL1.bit.GPIO15=0;
EDIS;
/***********中断I/O接口************/
GpioIntRegs.GPIOXINT1SEL.bit.GPIOSEL=0x0E;
GpioIntRegs.GPIOXINT2SEL.bit.GPIOSEL=0x0F;
/*******触发方式(下降沿)*********/
XIntruptRegs.XINT1CR.bit.POLARITY=0;
XIntruptRegs.XINT2CR.bit.POLARITY=0;
/*********使能XINT1、XINT2*********/
XIntruptRegs.XINT1CR.bit.ENABLE=1;
XIntruptRegs.XINT2CR.bit.ENABLE=1;
/**************D10、D11屏蔽******************/
for(;;);
}
/*********************中断子程序***********************/
interrupt void Light_led1(void)
{
Uint32 i;
int A;
A=K3_SWITCH;
for(i=0;i<10000000;i++);
while(A==0)
D10_ON;
DELAY1(TIME);
PieCtrlRegs.PIEACK.all=PIEACK_GROUP1;
}
interrupt void Light_led2(void)
{
Uint32 i;
Uint32 j;
int B;
B=K4_SWITCH;
for(i=0;i<10000000;i++);
while(B==0)
for(j=0;j<5;j++)
{
D11_ON;
DELAY1(TIME);
D11_OFF;
DELAY1(TIME);
}
PieCtrlRegs.PIEACK.all=PIEACK_GROUP1;
}
PIE向量的函数地址屏蔽掉了还有中断组的启用也有问题