麻烦大家看一下,我的代码如下,我想在PIT中断服务程序中从串口发送一个字节,并让LED灯闪烁。可Main函数好像一执行到MyPrvSetupTimerInterrupt就有问题,即无法响应中断服务程序,也无法进入Main函数的for循环中,问题出在哪?麻烦各位的解答了!
int main()
{
LED_Configure(0);
LED_Configure(1);
PIO_Configure(pins, PIO_LISTSIZE(pins));
ConfigureUsart0();
USART_Write(AT91C_BASE_US0, 0x11, 0);
MyPrvSetupTimerInterrupt();
for( ;; )
{
USART_Write(AT91C_BASE_US0, 0x10, 0);
}
}
static void MyPortTickISR( void )
{
volatile unsigned long ulDummy;
USART_Write(AT91C_BASE_US0, 0x00, 0);
ul3++;
if(ul3 <= 500)
{
LED1_ON;
}
else if (ul3 > 500 && ul3<=1000)
{
LED1_OFF;
}
else
{
ul3=0;
}
/* Clear the PIT interrupt. */
ulDummy = AT91C_BASE_PITC->PITC_PIVR;
/* To remove compiler warning. */
( void ) ulDummy;
}
static void MyPrvSetupTimerInterrupt( void )
{
const unsigned long ulPeriodIn_uS = ( 1.0 / ( double ) configTICK_RATE_HZ ) * port1SECOND_IN_uS;
/* Setup the PIT for the required frequency. */
PIT_Init( ulPeriodIn_uS, BOARD_MCK / port1MHz_IN_Hz );
/* Setup the PIT interrupt. */
AIC_DisableIT( AT91C_ID_SYS );
AIC_ConfigureIT( AT91C_ID_SYS, AT91C_AIC_PRIOR_LOWEST, MyPortTickISR );
AIC_EnableIT( AT91C_ID_SYS );
PIT_EnableIT();
}