This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TMS320C5505--定时器中断

尊敬的TI工程师,您好:

              我最近在学C5505,用的是官网的5505ezdsp开发板,在调试中断的时候一直调不通。

  (1)是否我的配置有问题。

  (2)vector.asm文件我添加到工程中,是不是添加的路径不对?

  (3)开发板自带的光盘里没有发现有定时器中断的程序,下边程序是我在其他地方找的,请问可否提供一下定时器0中断的例程。谢谢!

程序如下:


void Timer0Init()
{
CSL_Status status;
CSL_Config hwConfig;
CSL_GptObj gptObj;

/* Open the CSL GPT module */
hGpt = GPT_open (GPT_0, &gptObj, &status);

/* Reset the GPT module */
status = GPT_reset(hGpt);

/* Timer interval 0.5sec (2Hz)*/
hwConfig.autoLoad = GPT_AUTO_ENABLE;
hwConfig.ctrlTim = GPT_TIMER_ENABLE;
hwConfig.preScaleDiv = GPT_PRE_SC_DIV_11; // Pre scale Divide input clock by 4096
// 98.304M/4096 = 24K
hwConfig.prdLow = 0x2E00; // 24K/12K = 2Hz (12K = 0x2EE0)
hwConfig.prdHigh = 0x0000;

/* Configure Timer0 */
status = GPT_config(hGpt, &hwConfig);

/* Start timer */
GPT_start(hGpt);
}

/*
* Timer_isr( )
* Timer 0 interrupt service routine. This function is called
* whenever ther is a Timer interrupt.
*/
interrupt void tim_isr()
{
//USBSTK5505_LED_on(0);

/* Clear timer int flag */
CSL_CPU_REGS->IFR0 &= 0x0010;

/* Clear timer0 int flag */
CSL_TIM_0_REGS->TIMINT = 0x0001;

/*Clear Timer0 bit in Timer Aggregate register */
CSL_SYSCTRL_REGS->TIAFR |= 0x0001 ;
fTimer=1;

}

main()

{

Timer0Init();
while(1)
{
if (fTimer==1) USBSTK5505_LED_on(0);
}

}