在proteus中,定时器中断服务程序点亮LED灯,但是无法确认是否进入ISR,也无法确认是否从ISR中返回。请教大家!
代码:
#include <stdint.h>
#include <stdbool.h>
#include "hw_types.h"
#include "hw_memmap.h"
#include "hw_adc.h"
#include "hw_ints.h"
#include "../hw_nvic.h"
#include "sysctl.h"
#include "gpio.h"
#include "adc.h"
#include "interrupt.h"
#include "hw_timer.h"
#include "timer.h"
//#include "types.h"
#include "my_uart.h"
#define PIN GPIO_PIN_0
#define PORT GPIO_PORTD_BASE
void initRunLED()
{
SysCtlPeripheralEnable( SYSCTL_PERIPH_GPIOD );
GPIOPinTypeGPIOOutput( PORT, PIN );
}
void isr4timer0()
{
unsigned short i = 0;
TimerIntClear(TIMER0_BASE, TIMER_TIMA_TIMEOUT);
GPIOPinWrite( PORT, PIN, 1 );
for( ; i < 10000; i++ );
GPIOPinWrite( PORT, PIN, 0 );
}
int main()
{
unsigned long yu = 0;
initRunLED();
// drv_initUART();
//
// enable timer0
//
SysCtlPeripheralEnable(SYSCTL_PERIPH_TIMER0);
//
// diable timer0:timerA
//
TimerDisable(TIMER0_BASE, TIMER_A);
//
// timerA, periodic
//
TimerConfigure(TIMER0_BASE, TIMER_CFG_A_PERIODIC);
//
// load interval setting
//
TimerLoadSet(TIMER0_BASE, TIMER_A, SysCtlClockGet()/20);
//
// enable interrupt
//
IntMasterEnable();
//
// enable timerA interrupt
//
TimerIntEnable(TIMER0_BASE, TIMER_TIMA_TIMEOUT);
//
//
//
IntEnable(INT_TIMER0A);
TimerIntRegister(TIMER0_BASE, TIMER_A, isr4timer0);
//
//
//
TimerEnable(TIMER0_BASE, TIMER_A);
// LOG_STRING("6");
while( 1 )
{
yu = TimerLoadGet(TIMER0_BASE, TIMER_A);
// LOG_ULONG( yu );
}
return 0;
}