This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

【新人贴】关于TM4C的0B定时器中断配置出现错误

Other Parts Discussed in Thread: EK-TM4C123GXL, TM4C123GH6PM

先附一波源码!*★,°*:.☆( ̄▽ ̄)/$:*.°★* 。:

#include <stdint.h>
#include <stdbool.h>
#include <stdio.h>
#include "hw_memmap.h"
#include "hw_types.h"
#include "hw_gpio.h"
#include "hw_nvic.h"
#include "hw_ints.h"
#include "debug.h"
#include "gpio.h"
#include "pin_map.h"
#include "sysctl.h"
#include "interrupt.h"
#include "timer.h"
#include "uartstdio.h"

void Timer0B_Init(void);

int main(void)
{
SysCtlClockSet(SYSCTL_SYSDIV_4 | SYSCTL_USE_PLL | SYSCTL_XTAL_16MHZ | SYSCTL_OSC_MAIN);
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF);
GPIOPinTypeGPIOOutput(GPIO_PORTF_BASE,GPIO_PIN_2);
Timer0B_Init();
while(1)
{
;
}
}
void TIMER0B_Handler(void)
{
TimerIntClear(TIMER0_BASE,TIMER_TIMB_TIMEOUT);
if(GPIOPinRead(GPIO_PORTF_BASE,GPIO_PIN_2))
{
GPIOPinWrite(GPIO_PORTF_BASE,GPIO_PIN_2,0);
}
else
{
GPIOPinWrite(GPIO_PORTF_BASE,GPIO_PIN_2,GPIO_PIN_2);
}
}


void Timer0B_Init()
{
SysCtlPeripheralEnable(SYSCTL_PERIPH_TIMER0);
TimerConfigure(TIMER0_BASE,TIMER_CFG_PERIODIC);
TimerLoadSet(TIMER0_BASE,TIMER_B,SysCtlClockGet()/4);
IntEnable(INT_TIMER0B);
TimerIntEnable(TIMER0_BASE,TIMER_TIMB_TIMEOUT);
IntMasterEnable();
TimerEnable(TIMER0_BASE,TIMER_B);
}

我用0A和1A的定时器中断都完成了闪灯o(* ̄▽ ̄*)o,可是到了TIMER B就不行了ヽ(✿゚▽゚)ノ,是不是我没发现B的正确用法φ(゜▽゜*)♪,还是配置有错误?

请高人指点 (´▽`ʃ♡ƪ)