注册 登录
电子工程世界-论坛 返回首页 EEWORLD首页 频道 EE大学堂 下载中心 Datasheet 专题
bruthroc的个人空间 https://home.eeworld.com.cn/space-uid-362977.html [收藏] [复制] [分享] [RSS]
日志

Cortex-M3为什么无法进入中断?

已有 767 次阅读2011-9-29 13:37

我用的M3S811,但不知道为什么进不了中断?

下面是我的程序:

#include "lm3s811.h"
#include "m3io.h"
#include "driverlib/timer.h"
#include "driverlib/sysctl.h"
#include "driverlib/gpio.h"
#include "inc/hw_memmap.h"
#include "inc/hw_ints.h"
#include "driverlib/interrupt.h"
void GPIO_Interrupt_Sever();
void Timer0ATimeoutIntHandler();

volatile unsigned long ulLoop;
main()
{
 SysCtlClockSet(SYSCTL_SYSDIV_4|SYSCTL_USE_PLL|SYSCTL_XTAL_6MHZ|SYSCTL_OSC_INT4);//设置主时钟PLL
 SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOD|SYSCTL_RCGC2_GPIOC);//使能GPIO
 GPIOPinTypeGPIOOutput(GPIO_PORTC_BASE,GPIO_PIN_5);//输出模式
 GPIOPinTypeGPIOOutputOD(GPIO_PORTD_BASE,GPIO_PIN_7);//开漏模式

 IntMasterEnable();//使能全局中断
    SysCtlPeripheralEnable(SYSCTL_PERIPH_TIMER1);//打开定时器
    TimerConfigure(TIMER1_BASE,TIMER_CFG_16_BIT_PAIR|TIMER_CFG_A_PERIODIC);//设置定时器工作方式
    TimerPrescaleSet(TIMER1_BASE,TIMER_A,0x007f);//设置分频
    TimerLoadSet(TIMER1_BASE,TIMER_A,0xffff);//装初值
    TimerIntEnable(TIMER1_BASE,TIMER_TIMA_TIMEOUT);//使能TIMER0A的溢出中断
    TimerIntRegister(TIMER1_BASE,TIMER_A,Timer0ATimeoutIntHandler);//将TIMER0A中断服务进程设置为void Timer0ATimeoutIntHandler(void)
    TimerEnable(TIMER1_BASE,TIMER_A);//打开定时器开始计时
    while(1)
    {
    }
}
void Timer0ATimeoutIntHandler(void)
{
    TimerIntClear(TIMER0_BASE,TIMER_TIMA_TIMEOUT);                //清除中断标志位
while(1)
{
        PC5_0;
  PD7_1;
        for(ulLoop = 0; ulLoop < 200000; ulLoop++)
        {
        }
        PC5_1;//输出高
  PD7_0;
        for(ulLoop = 0; ulLoop < 200000; ulLoop++)
        {
        }
}

}
请各位大侠帮帮忙啊!

评论 (0 个评论)

facelist doodle 涂鸦板

您需要登录后才可以评论 登录 | 注册

热门文章