打印
[ARM9、LPC]

如何设置AT91SAM9G20的PIT中断

[复制链接]
717|0
手机看帖
扫描二维码
随时随地手机跟帖
跳转到指定楼层
楼主
BrilliantDT|  楼主 | 2015-4-22 21:34 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
at91, pi, sam, TI, se
本帖最后由 BrilliantDT 于 2015-4-22 21:40 编辑

麻烦大家看一下,我的代码如下,我想在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();
}

相关帖子

发新帖 我要提问
您需要登录后才可以回帖 登录 | 注册

本版积分规则

1

主题

1

帖子

0

粉丝