我用的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++)
{
}
}
}
请各位大侠帮帮忙啊!
此帖出自
小平头技术问答
一周热门 更多>