TI中文支持网
TI专业的中文技术问题搜集分享网站

为什么我的TM4C1294NCPDT上升沿计时器中断总是进入FaultISR(void)函数

/**
* main.c
*/

#include <stdint.h>
#include <stdbool.h>
#include "driverlib/sysctl.h"
#include "inc/hw_types.h"
#include "inc/hw_memmap.h"
#include "driverlib/sysctl.h"
#include "driverlib/gpio.h"
#include "inc/hw_ints.h"
#include "driverlib/interrupt.h"
#include "driverlib/timer.h"
#include "driverlib/pin_map.h"

uint32_t ui32SysClkFreq;
#define D2 GPIO_PIN_0
#define D1 GPIO_PIN_1
int Flag=0;
float ulPeriod;
char result;

void Timer1AIntHandler(void){
unsigned long ulstatus;
ulstatus = TimerIntStatus(TIMER1_BASE, TIMER_CAPA_EVENT);
TimerIntClear(TIMER1_BASE, ulstatus);
result=TimerValueGet(TIMER1_BASE, TIMER_A);
if(result==0){
GPIOPinWrite(GPIO_PORTN_BASE, D2|D1, 3);
}
}

void main(void)
{
ui32SysClkFreq=SysCtlClockFreqSet((SYSCTL_XTAL_25MHZ |
SYSCTL_OSC_MAIN |
SYSCTL_USE_PLL |
SYSCTL_CFG_VCO_480), 120000000);
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPION);//Turn on LED

GPIOPinTypeGPIOOutput(GPIO_PORTN_BASE, D2|D1);
SysCtlDelay(10);
GPIOPinConfigure(GPIO_PD2_T1CCP0);
GPIOPinTypeTimer(GPIO_PORTD_BASE,GPIO_PIN_2);
GPIOPadConfigSet(GPIO_PORTD_BASE,GPIO_PIN_2, GPIO_STRENGTH_2MA, GPIO_PIN_TYPE_STD_WPU);
TimerConfigure(TIMER1_BASE, TIMER_CFG_SPLIT_PAIR | TIMER_CFG_A_CAP_TIME_UP);
TimerControlEvent(TIMER1_BASE, TIMER_A, TIMER_EVENT_POS_EDGE);
TimerMatchSet(TIMER1_BASE, TIMER_A, 0x8FFF);
TimerIntRegister(TIMER1_BASE, TIMER_A, Timer1AIntHandler);
IntMasterEnable();
TimerIntEnable(TIMER1_BASE, TIMER_CAPA_MATCH);
IntEnable(INT_TIMER1A);
TimerEnable(TIMER1_BASE, TIMER_A);

while(1){

}
}

shuai Liu:

不知道为什么就是不对,看了一些帖子说加延时,然后我加了掩饰也是同样的效果。真的有点迷糊了

Seven Han:

回复 shuai Liu:

请参考下以下调试说明:

http://www.ti.com.cn/cn/lit/an/spma043/spma043.pdf

赞(0)
未经允许不得转载:TI中文支持网 » 为什么我的TM4C1294NCPDT上升沿计时器中断总是进入FaultISR(void)函数
分享到: 更多 (0)