#include"DSP2833x_Project.h"
void delay(Uint32 i)
{
while(i--);
}
#define LED1_ON GpioDataRegs.GPASET.bit.GPIO0=1;
#define LED2_ON GpioDataRegs.GPASET.bit.GPIO1=1;
#define LED3_ON GpioDataRegs.GPASET.bit.GPIO2=1;
#define LED4_ON GpioDataRegs.GPASET.bit.GPIO3=1;
#define LED5_ON GpioDataRegs.GPASET.bit.GPIO4=1;
#define LED6_ON GpioDataRegs.GPASET.bit.GPIO5=1;
#define LED7_ON GpioDataRegs.GPASET.bit.GPIO24=1;
#define LED8_ON GpioDataRegs.GPASET.bit.GPIO25=1;
#define LED1_OFF GpioDataRegs.GPACLEAR.bit.GPIO0=0;
#define LED2_OFF GpioDataRegs.GPACLEAR.bit.GPIO1=0;
#define LED3_OFF GpioDataRegs.GPACLEAR.bit.GPIO2=0;
#define LED4_OFF GpioDataRegs.GPACLEAR.bit.GPIO3=0;
#define LED5_OFF GpioDataRegs.GPACLEAR.bit.GPIO4=0;
#define LED6_OFF GpioDataRegs.GPACLEAR.bit.GPIO5=0;
#define LED7_OFF GpioDataRegs.GPACLEAR.bit.GPIO24=0;
#define LED8_OFF GpioDataRegs.GPACLEAR.bit.GPIO25=0;
interrupt void timer0_isr(void);
void main(void)
{
InitSysCtrl();
DINT;
InitPieCtrl();
IFR=0X0000;
IER=0X0000;
InitPieVectTable();
EALLOW;
PieVectTable.TINT0=&timer0_isr;
EDIS;
InitGpio();
InitCpuTimers();
#if(CPU_FRQ_150MHZ)
ConfigCpuTimer(&CpuTimer0, 150, 1000000);
#endif
CpuTimer0Regs.TCR.all=0x4001;
IER|=M_INT1;
PieCtrlRegs.PIEIER1.bit.INTx7=1;
EINT;
for(;;);
}
int shu;
interrupt void timer0_isr(void)
{
shu++;
LED1_ON;
delay(5000000);
LED1_OFF;
LED2_ON;
delay(5000000);
LED2_OFF;
LED3_ON;
delay(5000000);
LED3_OFF;
LED4_ON;
delay(5000000);
LED4_OFF;
LED5_ON;
delay(5000000);
LED5_OFF;
LED6_ON;
delay(5000000);
LED6_OFF;
LED7_ON;
delay(5000000);
LED7_OFF;
LED8_ON;
delay(5000000);
LED8_OFF;
PieCtrlRegs.PIEACK.all=0x01;
CpuTimer0Regs.TCR.bit.TRB=0;
CpuTimer0Regs.TCR.bit.TIF=1;
}
以上是我编写的程序。在板子上运行的结果是灯循环亮了一遍后都灭了。请问这个程序是哪里出错了呀?
此帖出自
小平头技术问答
嗯嗯 谢谢回复 我试一下
按你说的把TIE关了再开还是不行。。只要一灭就不亮了。
一周热门 更多>